in reply to Re^2: How to make a menu using my subroutines?
in thread How to make a menu using my subroutines?

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"; }
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^4: How to make a menu using my subroutines?
by astronogun (Sexton) on Apr 03, 2012 at 07:32 UTC
    yes like that, but much better if the selection or the menu will also appear again and then you will choose again the number. Edited: Already figured it out :) thanks for the help tobyink