As someone said, you can't just make stuff up and expect the computer to know what you want. :-)
Slow down. Have another look at the links you've been given and use plenty of Data::Dumper at every step. Good luck!
#!/usr/local/bin/perl
use strict;
use warnings;
use Data::Dumper;
$Data::Dumper::Indent = 1;
$Data::Dumper::Sortkeys = 1;
my %hash = (
'summary' => {
'allotments' => 679
},
'prefix' => {
'32 ' => 425,
'45 ' => 5,
'41 ' => 2,
'46 ' => 5,
'44 ' => 1,
'47 ' => 9,
'43 ' => 1,
'27 ' => 1,
'48 ' => 212,
'22 ' => 14,
'29 ' => 2,
'40 ' => 2
},
);
for my $key (keys %hash){
print qq{key: $key\n};
for my $subkey (keys %{$hash{$key}}){
print qq{\tsubkey: $subkey\n};
}
}
outputs
key: summary
subkey: allotments
key: prefix
subkey: 32
subkey: 45
subkey: 41
subkey: 44
subkey: 46
subkey: 47
subkey: 27
subkey: 43
subkey: 48
subkey: 29
subkey: 22
subkey: 40
|