Thanks for the style tip. Yes, started out in C and I'm still getting used to thinking in perl.

As far as the array names, they were used for ease of input for this problem only. Their real names look like: $high_price, $low_price, etc.

As to what I want to achieve; the data I'm reading in consists of a file with many different sets of input all smashed together. Ten years of a stock's high price then ten years of a stock's low price and then ten years of a stock's something else, etc. I figured that using an array with the elements in order of their appearance in the data would make it easy for me to get to by reading the index of the array and multiplying by 10 (number of years) and then doing a loop to add the data into the hash ($high_price{1995}=52.50).

I'm writing my first, uh, program with perl. I'm a system administrator and I live off of one-liners and one-off scripts, so my ability to do this in perl is being stretched.

Again, thanks for your help,
- chris


In reply to Re: Re: Interpolating an array element as a hash name. by yam
in thread Interpolating an array element as a hash name. by yam

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.