see bottom...

-----Original Message-----
From: P lerenard [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 09, 2002 1:21 PM
To: [EMAIL PROTECTED]
Subject: sort a hash


Hi,

@array = qx{egrep -n '\{' file);
foreach $el (@array)
{
($num,@other} = split(/\:/,$el);
$thenum{$num} = $num;
}

foreach $ele (sort keys %thenum)
{
print"$ele\n";
}
except this one sort by string and not by integer, so 100 is before 99
Do you have an idea to sort that by interger and not by string, 99 before
100?

-----Response Text-----
You are using the default sort operation (string).  You want to use a
numeric sort, so you will need to provide your own block for sorting.

perldoc -f sort

foreach $ele (sort {$a <=> $b} keys %thenum)

                                /\/\ark


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

Reply via email to