Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: how to manage a large console menu

by TedPride (Priest)
on May 22, 2006 at 18:15 UTC ( [id://550995]=note: print w/replies, xml ) Need Help??


in reply to how to manage a large console menu

use strict; use warnings; my @hosts = ( { 'name' => 'Site 1', 'host' => 'hostname1' }, { 'name' => 'Site 2', 'host' => 'hostname2' }, { 'name' => 'Site 3', 'host' => 'hostname3' }, ## Etc... ); while (1) { print "Please pick which system you wish to FTP to:\n"; print $_+1, ') ', $hosts[$_]{'name'}, "\n" for 0..$#hosts; print "Q) Quit\n\n"; chomp($_ = <STDIN>); last if uc($_) eq 'Q'; dftp($hosts[$_-1]{'host'}); print "\n"; }
Since you probably want them in a specific order, the outer structure should be an array. Since you might want to add more data about each item in the future, and don't want to have to worry about order, the inner structure should be a hash.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://550995]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-25 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found