Heynow!
I'm not sure if what I'm doing here is a reference (E-Eng trying to learn Perl on my own) so sorry if this is a waste of your time. Normally I'm able to solve my problems by using the search engine.

I'm trying to create an array name from a line of information I've found in another array. Then I would like to be able to push data into that array and print it out to a file later on.

What I think I need to do is use a reference ... but I don't think I'm doing it correctly and I'm getting lost Programming Perl: Chapter 8. I use references in Tk and other modules but I've always just learned by example

Realise I'm way off here and would appreciate help even if it's just to a page in the book or a node I should read.

Here's what I'm doing ... part of a bigger file.

Thanks,
James

scalar(@dev_list) == $#dev_list + 1; scalar(@xref) == $#xref + 1; for ($i=0; $i < (scalar(@dev_list)); $i++) { print STDOUT "Looking for $dev_list[$i]\n"; for ($c=0;$c < (scalar(@xref)); $c++) { if($xref[$c] =~ /$dev_list[$i]\./i) { $templine = join "_","\@dev_xref",$dev_list[$i]; $dev_array_ref = \($templine); push(\$dev_array_ref, $xref[$c]); } } }

Edit: Corrected the <code> tag. larsen


In reply to creating an array name using information from another array by Balls McWang

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.