in reply to RE: Simple menu..
in thread Simple menu..

Sorry for the sloppy post. I want to type in 'command1' and have it run that subroutine.

Replies are listed 'Best First'.
Re: RE: RE: Simple menu..
by Anonymous Monk on Nov 20, 2003 at 13:03 UTC
    You need to dereference the function name, see 11.4 in the cookbook # entering 'happy' runs the routine 'joy' eg %command = ( "happy" => \&joy ); chomp($feeling = <STDIN>); if($command{$feeling}){ $command{$feeling}->(); } sub joy{ print "happy huh \?"; }