in reply to Sorting data structure

Something like this (assuming 'count' contains a numeric value):

my( @sorted ) = sort { $users{$a}->{count} <=> $users{$b}->{count} } keys %users; print "$_ => $users{$_}->{count}\n" foreach @sorted;

Dave

Replies are listed 'Best First'.
Re^2: Sorting data structure
by leriksen (Curate) on Oct 14, 2005 at 04:09 UTC
    And if it isn't numeric, replace the '<=>' (spaceship operator) with 'cmp' .

    ...reality must take precedence over public relations, for nature cannot be fooled. - R P Feynmann