excellent suggestions etc but the tricky bit of the question is how to call this perl script from command line to request this particular HoA (names) or another, e.g. birthdates.
without coding this myself, I suggest that part of the solution would be to use one of the standard args modules, which provides a nice mechanism to supply and parse zero or more args to perl in any order/combination. anyway, something possibly to consider. the harder bit of not passing symbolic reference can be done by testing the value supplied to the perl script against possible requests in a switch e.g.
my $request = shift; switch($request) { case 'names' print @names; case 'birthdays' print @birthdays; else print 'unknown request`; }
and so forth. if as in my example the names and birthdays are parts of a proper record set and related, e.g. person 1 -> birthday 1, then a slightly more elaborate structure can be created with a hash etc.
in any case, using such switch or even if statements obviates need to use directly the value of one variable as a symbolic link to another variable.
the hardest line to type correctly is: stty erase ^H

In reply to Re^2: using input as array name by aquarium
in thread using input as array name by calmthestorm

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.