Did you use warnings and use strict when you ran the code?
But that aside, you are doing some strange things:
my $k=0,$str=""; for(my $i=0; $i<4;$i+=1) { @entry=undef; for my $j (0..7) { $h{"BUCK_$j"} = $bucket[$k+$j]; push @entry,\%h; }
The loop above will add 8 identical references to %h to @entry.
$hash_table[$i] = { ENTRY => [@entry]}; $k+=8; } #end of for i for(my $i=0; $i<4;$i+=1) { print "ENTRY-0-BUCK-0::", $hash_table[$i]->{ENTRY}->{BUCK_0}, "\n";
You can't address $hash_table like that since it is an array of hash references containing just the key ENTRY (which is a warning sign) that has the value array reference containing hash references.
}
Did you try following the advice and tried Data::Dumper on, say, (updated) @hash_table?
In reply to Re^3: Perl Array of Hashes
by mzedeler
in thread Perl Array of Hashes
by abhay180
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |