berniep has asked for the wisdom of the Perl Monks concerning the following question:
$acct gets set with a radio button variable:-command => [\&Account_Setup, $acct]
The subroutine contains a simple print statement for testing:$f->Radiobutton(-text => "Investment", -value => "investment", -variable => \$acct)->pack(-side => 'top', -anchor => 'w');
The problem is, the button code above doesn't seem to be passing the value stored in $acct. However, this code on the button works:sub Account_Setup{ my ($acct_type) = shift; print "Account Type: $acct_type\n"; }
In addition, if I set the value of $acct right before passing it, the subroutine seems to work fine as well. Is this some sort of scope problem or am I missing something really obvious? Any suggestions would be greatly appreciated. TIA.-command => sub{ print "Account: $acct\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Scope with Perl/Tk
by pjf (Curate) on Oct 12, 2001 at 07:05 UTC | |
by Anonymous Monk on Oct 12, 2001 at 07:23 UTC |