You want something like:
my $menu_item; while (lc $menu_item ne 'q') { # allow 'q' to quit print "Enter your choice here: "; $menu_item = <>; chomp($menu_item); (defined $action{$menu_item}) ? $action{$menu_item}->() : print "Wro +ng input. \n"; }
In reply to Re^3: How to make a menu using my subroutines?
by tobyink
in thread How to make a menu using my subroutines?
by astronogun
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |