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.

May the Force be with you

Replies are listed 'Best First'.
Re^2: Quick question about Tk(?)
by pg (Canon) on Sep 24, 2004 at 16:14 UTC

    Your described what I wanted, but the solution does not work. More thoughts?

      Did you try JediWizard's second method - it worked perfectly when I tried it.