Thread der wievielte durchlauf einer for schleife? (12 answers)
Opened by vayu at 2005-10-21 19:42

frodus
 2005-10-21 20:21
#59120 #59120
User since
2003-09-26
147 Artikel
BenutzerIn
[default_avatar]
[quote=vayu,21.10.2005, 18:12]
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
%labels = {
"lab1" => $frm_name->Label(-text=>"Server name:"),
"ent1" => $frm_name->Entry(),
"lab2" => $frm_name->Label(-text=>"Server domain:"),
"ent2" => $frm_name->Entry(),
"lab3" => $frm_name->Label(-text=>"User name:"),
"ent3" => $frm_name->Entry(),
"lab4" => $frm_name->Label(-text=>"Password:"),
"ent4" => $frm_name->Entry()
};
for(1..4) {
$labels{'lab'.$_}->pack();
$labels{'ent'.$_}->pack();
}


hmmm .. das gibt mir leider nen undef hash zurück O.o

Fehlermeldung (Zeile 64 ist da wo mein code beginnt):

Quote
Reference found where even-sized list expected at pin-mail.pl line 64.
Tk::Error: Can't call method "pack" on an undefined value at pin-mail.pl line 76
.
Tk callback for .frame
main::addNewMailAccount at pin-mail.pl line 76
Tk callback for .button1
Tk:: at C:/Perl/site/lib/Tk.pm line 252
Tk::Button::butUp at C:/Perl/site/lib/Tk/Button.pm line 111
<ButtonRelease-1>
(command bound to event)
[/quote]
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
$labels = {
"lab1" => $frm_name->Label(-text=>"Server name:"),
"ent1" => $frm_name->Entry(),
"lab2" => $frm_name->Label(-text=>"Server domain:"),
"ent2" => $frm_name->Entry(),
"lab3" => $frm_name->Label(-text=>"User name:"),
"ent3" => $frm_name->Entry(),
"lab4" => $frm_name->Label(-text=>"Password:"),
"ent4" => $frm_name->Entry()
};
for(1..4) {
$labels->{'lab'.$_}->pack();
$labels->{'ent'.$_}->pack();
}


Vielleich so?

/Frodus

View full thread der wievielte durchlauf einer for schleife?