in reply to Re^2: how to manage a large console menu
in thread how to manage a large console menu
The potential downside to making it a hash is that you have to sacrifice keeping it in the order you like (unless order isn't important, or you don't mind just using the order which sort generates).
Another option which lets you keep the order you prefer, and still have corresponding values for each of your "keys" would be to have both an array *and* a hash, eg.:
which gives a nice flexibility, but requires making updates in two data structures rather than just one.my @systems = qw( this_system_should_be_first system1 system2 system3 the_final_system ); my %systems = ( this_system_should_be_first => 'hostname_to_first_system', system1 => 'hostname_to_system1', system2 => 'hostname_to_system2', system3 => 'hostname_to_system3', the_final_system => 'hostname_to_final_system', );
The tradeoff one chooses will ultimately be a matter of personal preference and/or need.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: how to manage a large console menu
by BUU (Prior) on May 22, 2006 at 19:44 UTC | |
|
Re^4: how to manage a large console menu
by parv (Parson) on May 22, 2006 at 20:05 UTC |