in reply to Re^2: Hash sorting
in thread Hash sorting

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.

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
Re^4: Hash sorting
by johngg (Canon) on May 15, 2006 at 08:42 UTC
    ITYM print "$key : $hash{$key}\n";

    Cheers,

    JohnGG