in reply to Quick question about Tk(?)
$mw->Button(text => $tasks->{"task"}->[$_]->{"description"}, command = +> sub {pub("$_")})->pack();
Or ...
$mw->Button(text => $tasks->{"task"}->[$_]->{"description"}, command = +> [\&pub, "$_"])->pack();
I belive the problem is that Tk is passing you the value of $_ at the time the button is pressed, and it appears you want the value of $_ from the time the button is created.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Quick question about Tk(?)
by pg (Canon) on Sep 24, 2004 at 16:14 UTC | |
by Arunbear (Prior) on Sep 24, 2004 at 16:26 UTC |