Thread Wie benutzt man Variablen innerhalb eines String blocks <<
(3 answers)
Opened by crojay at 2012-10-19 15:47
Hallo,
kann mir jemand verraten wie ich eine counter Variable innerhalb meines << Blocks verwenden kann? Aktuell liefert mir der compiler folgende Fehler. In einem anderem Fall konnte ich meine Variable innerhalb eines << Blocks verwenden, aber dort hing es aber auch nicht direkt an einem Text. Danke Global symbol "$i_0" requires explicit package name at D:/development/perl/SupportCases/createFTL.pl line 76. Global symbol "$i_0" requires explicit package name at D:/development/perl/SupportCases/createFTL.pl line 76. Global symbol "$i_1" requires explicit package name at D:/development/perl/SupportCases/createFTL.pl line 76. Global symbol "$i_1" requires explicit package name at D:/development/perl/SupportCases/createFTL.pl line 76. Global symbol "$i_2" requires explicit package name at D:/development/perl/SupportCases/createFTL.pl line 76. Global symbol "$i_2" requires explicit package name at D:/development/perl/SupportCases/createFTL.pl line 76. Global symbol "$i_0" requires explicit package name at D:/development/perl/SupportCases/createFTL.pl line 76. Global symbol "$i_1" requires explicit package name at D:/development/perl/SupportCases/createFTL.pl line 76. Global symbol "$i_2" requires explicit package name at D:/development/perl/SupportCases/createFTL.pl line 76. Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 my $i = 1; for ($i = 1; $i <=6; $i++){ my $block = <<BLOCK; <#if ((model.fields.txt_Artikel_Z$i?? || model.fields.txt_Artikel_Z$i.value = "") && (model.fields.txt_Artikelnummer_Z$i?? || model.fields.txt_Artikelnummer_Z$i.value = "") && (model.fields.txt_Anzahl_Z$i?? || model.fields.txt_Anzahl_Z$i.value = "") && (model.fields.chk_Ware_aus_Z$i_0?? || model.fields.chk_Ware_aus_Z$i_0.value = "") && (model.fields.chk_Ware_aus_Z$i_1?? || model.fields.chk_Ware_aus_Z$i_1.value = "")&& (model.fields.chk_Ware_aus_Z$i_2?? || model.fields.chk_Ware_aus_Z$i_2.value = "")) && (!(model.fields.txt_Artikel_Z$i.value = "") && !(model.fields.txt_Artikelnummer_Z$i.value = "") && !(model.fields.txt_Anzahl_Z$i.value = "") && !(model.fields.chk_Ware_aus_Z$i_0.value = "") && !(model.fields.chk_Ware_aus_Z$i_1.value = "")&& !(model.fields.chk_Ware_aus_Z$i_2.value = "")) > <#else> <result type="ERROR" field="txt_Fehlerbericht_Arbeiten_Z$i" code="-1" message="Komplette Zeile $i muss ausgefüllt sein!" /> </#if> BLOCK print "$block"; } modedit Editiert von pq: einige tabs entfernt Last edited: 2012-10-19 16:27:09 +0200 (CEST) |