Look up "autovivification":
http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=perl+autovivification
&btnG=Search
Just part of the power of Perl.
--
Mike Arms
> -Original Message-
> From: Matt Bazan [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 08, 2004 4:51 PM
> To: [EMAIL PROTECTED]
> Subject: RE: named hash inside of hash
>
>
> Thanks for help, it's starting to make sense. I don't understand this
> line:
>
> $ips{$source_ip}->{$dest_ip}++;
>
> how can you access and increment something that doesnt exist? Thanks
> again.
>
> > -Original Message-
> > From: Peter Guzis [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, June 08, 2004 12:50 PM
> > To: Matt Bazan; Thomas, Mark - BLS CTR
> > Cc: [EMAIL PROTECTED]
> > Subject: RE: named hash inside of hash
> >
> > Like this?
> >
> > ## begin code
> >
> > use strict;
> > use Data::Dumper;
> >
> > my %ips;
> >
> > foreach my $source_ip ('192.168.1.2', '192.168.1.1',
> '192.168.1.12') {
> >
> > foreach my $dest_ip ('192.168.1.3', '192.168.9.19',
> '192.168.9.1') {
> >
> > $ips{$source_ip}->{$dest_ip}++;
> >
> > }
> >
> > }
> >
> > print Dumper \%ips;
> >
> > ## end code
> >
> >
> > Peter Guzis
> > Web Administrator, Sr.
> > ENCAD, Inc.
> > - A Kodak Company
> > email: [EMAIL PROTECTED]
> > www.encad.com
> >
> > -Original Message-
> > From: Matt Bazan [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, June 08, 2004 12:36 PM
> > To: Thomas, Mark - BLS CTR
> > Cc: [EMAIL PROTECTED]
> > Subject: RE: named hash inside of hash
> >
> >
> > Ok..here's a diagram:
> >
> > I need to setup a data structure that will keep track of a
> > source IP address. Each source IP address I then need to
> > link to a destination IP
> > (note: there can be multiple destiantion IP addresses for
> > each source) and a destination IP counter. So, something like:
> >
> > source IP 1 -> dst ip 1, counter
> >dst ip 2, counter
> >dst ip 3, counter
> > source IP 2 -> dst ip 1, counter
> >dst ip 2, counter
> >
> > etc, etc. Thanks!
> >
> > > -Original Message-
> > > From: Thomas, Mark - BLS CTR [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, June 08, 2004 12:28 PM
> > > To: Matt Bazan
> > > Cc: [EMAIL PROTECTED]
> > > Subject: RE: named hash inside of hash
> > >
> > > > create a hash who's first key's value is an anon ref to a
> > > hash who's
> > > > second key's value is a non-anon hash..get my drift?
> Is there an
> > > > easier way to do this? Thanks..
> > >
> > > I have no idea what you're saying... so here's a stab in the dark:
> > >
> > > my $data = {
> > > this => {
> > >is => {
> > > nested => 'true'
> > >},
> > >isnt => {
> > > nested => 'false'
> > >}
> > > }
> > >};
> > >
> > > print $data->{this}->{is}->{nested}; #prints 'true'
> > > print $data->{this}->{isnt}->{nested}; #prints 'false'
> > >
> > > Does that help?
> > >
> > > 'perldoc perldsc' may help too.
> > >
> > >
> > >
> > > --
> > > Mark Thomas[EMAIL PROTECTED]
> > > Internet Systems Architect DigitalNet, Inc.
> > >
> > > $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y;
> > > ;;print;;
> > >
> > >
> > >
> > >
> >
> > ___
> > Perl-Win32-Users mailing list
> > [EMAIL PROTECTED]
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> >
> >
>
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs