Please see How do I post a question effectively? and http://sscce.org/ - it would be much easier to answer your question if you could provide sample input data, a minimal code example that compiles, and some expected output corresponding to the example input.

Anyway, it seems like the line you are asking about is push $HASH{$MACS[$mac]}, [$VLANS[$vlan], [$INTS[$int]]; - it looks like you're trying to push an array reference ([$VLANS[$vlan], $INTS[$int]]) onto the value of $HASH{$MACS[$mac]}, but what is unclear from your code is what kind of a data structure that contains. Since you're using push, I'm going to guess it's an array reference. In that case, you need to dereference the array reference first via push @{...}, ...;, or in your case:

push @{ $HASH{$MACS[$mac]} }, [$VLANS[$vlan], $INTS[$int]];

But whether that'll get you the data structure you want depends on what you want your output data structure to look like, which you haven't shown us.

The document perldsc is a nice cookbook of code examples for Perl data structures that will very likely help you.


In reply to Re: Merging hashes at key match by Anonymous Monk
in thread Merging hashes at key match by GeorgMN

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.