Forgive me if i am not 100% clear on my question, its Monday morning and i have not had my first cup of coffee yet ;)
I have a script i am writing that will run in a console. In one of the parts of the script I have a menu where a user will need to choose which system he wants to ftp processed files to. The menu in question is a list of 40+ systems in it and I am wondering if there was a cleaner way of displaying all the options in the console that just doing a whole mess load of print/switch statements. I have found this makes it a pain in the butt to go back and make any changes to the list (ie adding a new system) to the list.
here is some example code of how i am displaying it
#displays the menu sub menu { print "Please pick which system you wish to FTP to:\n"; print "1.) system1\n"; print "2.) system2\n"; etc.. etc.. chomp(my $option = <>); } #switch statment using switch::perlish #hostnames changed to protect the innocent while ($option ne "q") { menu(); switch $option, sub { case '1', sub {dftp("hostname_to_system1")}; case '2', sub {dftp("hostname_to_system2")}; etc etc case 'q', sub {exit}; }
Thanks for the help!
In reply to how to manage a large console menu by paulehr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |