in reply to Calling External Subroutines from a local sub.
sets $id to the number of elements in @_ So you should do one of these things to do what you want:my $id = @_;
my ($id) = @_; my $id = $_[0]; my $id = shift;
The other thing is why did you use a typeglob to define that sub instead of simply doing
sub do_something { ... }
It would've done the same thing with less added syntax...
Then you state:
It works great the FIRST time you press the menu item "view configuration", but after that all my references seem to be overwritten or just have disappeared so If I select another menu item I dont get the elsif it just doesnt do anything.
do this:
And then print $subref before and after you think it has disappeared.$subref = \&do_something;
|
|---|