in reply to nested hashes and their usage e.g $foo{bar}{baz}
This situation is where I would usually use Data::Dumper to help show the entire data structure:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; + my %srciphash = ( '10.10.10.1' => { '10.10.10.2' => 'gw', '10.10.10.3' => 'dns', '10.10.10.4' => 'www', }, '10.10.20.1' => { '10.10.20.2' => 'gw', '10.10.20.3' => 'dns', '10.10.20.4' => 'www', }, ); + foreach my $a ( keys %srciphash ){ foreach my $b ( keys %{$srciphash{$a}} ){ #print $b,"\t",$srciphash{$a}{$b},"\n"; } } + print Dumper(\%srciphash),"\n";
$VAR1 = { '10.10.20.1' => { '10.10.20.4' => 'www', '10.10.20.3' => 'dns', '10.10.20.2' => 'gw' }, '10.10.10.1' => { '10.10.10.2' => 'gw', '10.10.10.4' => 'www', '10.10.10.3' => 'dns' } };
|
|---|