Chris_LSU has asked for the wisdom of the Perl Monks concerning the following question:
$srciphash{$srcip}{$dstip} = 1;
This is nested inside of a while loop, and no other action within the loop acts on srciphash. The $srcip and $dstip scalars are assembled from array elements earlier in the loop. I'm confused because I'm not exactly sure what it's doing.
After the while loop is done, this loop is started:
foreach $srcip (keys(%srciphash))
and within this loop, another loop is nested:
foreach $dstip (keys(%{$srciphash{$srcip}}))
Can anybody explain to me exactly what those 3 lines are supposed to mean? I'm hoping that I'm not the only Perl newb who's having trouble get a handle on the concept of hashes.
update (broquaint): title change (was wondering what exactly these lines does)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: nested hashes and their usage e.g $foo{bar}{baz}
by pfaut (Priest) on Feb 26, 2003 at 16:54 UTC | |
Re: nested hashes and their usage e.g $foo{bar}{baz}
by broquaint (Abbot) on Feb 26, 2003 at 16:57 UTC | |
Re: nested hashes and their usage e.g $foo{bar}{baz}
by jasonk (Parson) on Feb 26, 2003 at 16:54 UTC | |
Re: nested hashes and their usage e.g $foo{bar}{baz}
by crouchingpenguin (Priest) on Feb 26, 2003 at 17:13 UTC | |
Re: wondering what exactly these lines does
by mowgli (Friar) on Feb 26, 2003 at 17:05 UTC | |
Re: nested hashes and their usage e.g $foo{bar}{baz}
by blokhead (Monsignor) on Feb 26, 2003 at 17:00 UTC | |
Re: nested hashes and their usage e.g $foo{bar}{baz}
by pg (Canon) on Feb 26, 2003 at 17:52 UTC | |
Re: nested hashes and their usage e.g $foo{bar}{baz}
by Piercer (Beadle) on Feb 27, 2003 at 12:44 UTC |