however I need to print both the key names and values
Then print both :)
foreach my $key (sort keys %hash) { print "$key : $hash{$key}\n"; }
Update: typo fixed. Thanks to johngg for pointing it out.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re^3: Hash sorting
by davorg
in thread Hash sorting
by pickledegg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |