Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

map command, Tk, and $_

Status
Not open for further replies.

darkreaper00

Technical User
Aug 5, 2002
23
US
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] ) 
        );
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top