It appears that %srciphash is being used to associate source ips ($srcip) with their destinations ($dstip), so %srciphash is a hash which has the source ip as the key, and an anonymous hash as the value. The anonymous hash then contains the destination ip as the key, and '1' as the value. The first foreach loop iterates through the srcips (putting them into $srcip), and the second one iterates through all the destination ips associated with that source ip (putting them into $dstip). If you were to add print "$srcip talked to $dstip\n"; inside the last loop, it would show the relationship between the source and destination ips.


In reply to Re: nested hashes and their usage e.g $foo{bar}{baz} by jasonk
in thread nested hashes and their usage e.g $foo{bar}{baz} by Chris_LSU

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.