Code Comments
Programming Forum and web based access to our favorite programming groups.I am attempting to build a Tk:Optionmenu pull down from a string that
is passed to a sub-routine from one of my menu items. The string may
look like this:
2 3 8 10 14
The string WILL change, which is why I want to pass the string to my
menu pulldown as such:
my @slt_opt = qw/\$slt/;
$frame3->Label(-text => "Slot ID: ")->pack(-side => 'left',
-anchor => 's',
-expand => 1);
$frame3->Optionmenu(-variable => \$slots,
-options => [@slt_opt],
-command => [sub {print "args=@_\n"}, 'First']);
======================================
Am I reaching with what qw can do here?
Thanks in advance,
Joe
Post Follow-up to this messagejoe.cipale@radisys.com wrote: > I am attempting to build a Tk:Optionmenu pull down from a string that > is passed to a sub-routine from one of my menu items. The string may > look like this: > 2 3 8 10 14 > > The string WILL change, which is why I want to pass the string to my > menu pulldown as such: > > my @slt_opt = qw/\$slt/; qw() is not what you want. It will split it's argument on whitespace and quote each element. Checkout 'perldoc perlop' for more details. You simply want this: my @slt_opt = (\$slt); --Ala
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.