Yes, that's a valid point.  I considered using a hash in my example, but decided against it for the reason that, in this particular case, it's pretty easy to make the transformation from 'systemN' to 'hostname_to_systemN' for any value of N.

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.:

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', );
which gives a nice flexibility, but requires making updates in two data structures rather than just one.

The tradeoff one chooses will ultimately be a matter of personal preference and/or need.


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

In reply to Re^3: how to manage a large console menu by liverpole
in thread how to manage a large console menu by paulehr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.