Hey guys thanks for your help,

Ok so the thing with the array that it might have more then one value for a particular key, I was able to work around. Since the "values" that would have multiples were integers I just simply added them together then re-assigned the "temporary" array back to the original empty array. So that part is fixed...


So for assigning to a hash I was able to find some older scripts I wrote that had hashes and was able to use that and figure it out.

So since there were 5 different 2D-Arrays I came up with this to build the hash:
###These were the names of the arrays my (@AP_name, @AP_ipAddress, @AP_IOSversion, @AP_channelUtil, @AP_numC +lients); ################################################################### for (my $x = 0; $x <= $#AP_name; $x++) { $AP_data{ "$AP_name[$x][0]" } = { NAME => "$AP_name[$x][1]", IPADDRESS => "$AP_ipAddress[$x][1]", VERSION => "$AP_IOSversion[$x][1]", UTILIZATION => "$AP_channelUtil[$x][1]", NUMCLIENTS => "$AP_numClients[$x][1]" }; }

And since the arrays are already presorted when I collect the data it made it much easier to build the hash and not have to worry about comparing the Key/identifiers...


Thanks for your help..!

Thanks,
Matt



In reply to Re: Assign 2D-Arrays to a hash using a key by mmartin
in thread Assign 2D-Arrays to a hash using a key by mmartin

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.