Replace the following foreach $ele (sort keys %thenum with foreach $ele (sort {$a <=> $b} keys %thenum) This will do ascending numeric or if descending switch the a and b around.
Wags ;) -----Original Message----- From: P lerenard [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 13:21 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? I tried to rebuild the key and even using the function int() but i'm stuck. Thank you Pierre _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ********************************************************** This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. **************************************************************** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]