Dan wrote:
> 
> I have a small query regarding how to sort hash entries in numerical order.
> 
> %usernum { "server.one.com" "15",
>                     "server.two.com" "5",
>                     "server.three.com" "14",
>                     "server.four.com" "9" }
> 
> How can i get perl to return these 4 server names in the correct order,
> server.two.com
> server.four.com
> server.three.com
> server.one.com


my %usernum = (
    'server.one.com',   15,
    'server.two.com',    5,
    'server.three.com', 14,
    'server.four.com',   9,
    );

my @sorted = sort { $usernum{$a} <=> $usernum{$b} } keys %usernum;



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to