Here's how to iterate through a hash in Perl:
foreach my $key (keys %myhash)
{
print "key: $key value: $myhash{$key}\n";
}
I like this construct because it's pretty clear what's happening.
Ad: Learning Perl, 5th Edition
foreach my $key (keys %myhash)
{
print "key: $key value: $myhash{$key}\n";
}
No comments:
Post a Comment