Re: create multiple hash



creating a multiple hash is the same as you create a common hash.
you can do,

my %value;
$value{'172.16.1.45'} = {'google' => 34};
$value{'172.15.2.34'} = {'yahoo' => 45};
etc.

to show the hash structure, use Data::Dumper:

use Data::Dumper;
print Dumper \%hash;

to print the hash, use a for loop:

for my $outkey (keys %hash) {
for my $inkey (keys %{$hash{$outkey}}) {
print $inkey, ": ", $hash{$outkey}->{$inkey},"\n";
}
}

Not tested it.Good luck.

Regards,
Jeff (Joy) Peng

On Fri, Mar 21, 2008 at 6:33 PM, sivasakthi <msivasakthi@xxxxxxxxx> wrote:
Hi all,

I want to create multiple hash and retrieve the values for print like
below ,

%values= (
'172.16.1.45' => {'google.com' => 34, 'linux.com' => 45},
'172.15.2.34' => {'hp.com' => 345, 'oracle.com' => 4567},

);


how to do that?



Thanks,

.