thank you all special thanks for the first 3 on the podium
Pierre >From: "Mark Anderson" <[EMAIL PROTECTED]> >To: "P lerenard" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> >Subject: RE: sort a hash >Date: Wed, 9 Oct 2002 13:28:40 -0700 > >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] _________________________________________________________________ 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]