in reply to Perl/Tk menu and commands based on array
Hi richie,
Just to expand briefly on what tybalt89 mentioned: In Perl, closures like "sub {$fname = "$_"; &Restart}" in your code only "close over" lexicals (defined with my), and not global/package variables, that is those defined with our, or many of the special variables. $_ is one of those special variables that is a global. Whenever sub {$fname = "$_"} is executed, it will access the current value of $_.
Hope this helps,
-- Hauke D
|
|---|