On 10/26/07, newBee <[EMAIL PROTECTED]> wrote:
> I have the fallowing code segment in my code. I want to print my
> %termWeightHash to see if i have correct data at the end of the this
> computation. Since this hash has two keys(I guess way to think that is
> hash within) I am not sure how to print it..
>
If you only want to see if the data stru is correct or not,you can use
Data::Dumper.
use Data::Dumper;
print Dumper \%termWeightHash;
If you want to loop through a HoH,you can do something like:
use strict;
use warnings;
my %hash = ( 'keya' => { 'keya0' => 1 },
'keyb' => { 'keyb0' => 2,
'keyb1' => 3 },
);
for my $k1 (keys %hash) {
for my $k2 (keys %{$hash{$k1}}) {
print "$k1 -> $k2 -> ",$hash{$k1}{$k2},"\n";
}
}
__END__
see `perldoc perldata` for full details.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/