in reply to Perl/Tk menu and commands based on array

try:

foreach my $item (@filter) { $file_menu->command(-label => $item, -command => sub {$fname = $i +tem; &Restart});

it's a closure thing

Replies are listed 'Best First'.
Re^2: Perl/Tk menu and commands based on array
by richie (Initiate) on Feb 10, 2017 at 19:39 UTC
    Thank you very much!!! I knew there was something wrong with my logic but I am not familiar enough with perl to know how to structure it properly. Thanks :)