darkreaper00
Technical User
I'm running a map for checkbuttons in a grid. map should pass the same value to each $_, but it is not doing so. At first I had only the -text and -variable, and noticed that the variable passed was not the correct one. So I added the print STDERR command, and it's receiving an empty value of $_. I'm further confused by the fact that the order of my interpolations doesn't matter: as you can see the print command is now first, and the results are the same (only -text receives $_ correctly).
Code:
Tk::grid('^', ( map {$rw->Checkbutton( -command=>sub{print STDERR "clicked ~ $_ ~\n";},
-text=> $_, -selectcolor=>'chartreuse',
-font=>'arial 9 normal', -indicatoron=>0,
-variable=>$rpt_sel{$cat}{$_} )
} (@cascade)[0..$casc_max] )
);