Re: sort a hash

2002-10-09 Thread John W. Krahn
P Lerenard wrote: > > Hi, Hello, > @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 >

thanks RE: sort a hash

2002-10-09 Thread P lerenard
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 >

Thanks Re: sort a hash

2002-10-09 Thread P lerenard
thank you all really really quik answer Pierre >From: Michael Fowler <[EMAIL PROTECTED]> >To: P lerenard <[EMAIL PROTECTED]> >CC: [EMAIL PROTECTED] >Subject: Re: sort a hash >Date: Wed, 9 Oct 2002 12:33:28 -0800 > >On Wed, Oct 09, 2002 at 08:21:27PM +, P le

Re: sort a hash

2002-10-09 Thread Michael Fowler
On Wed, Oct 09, 2002 at 08:21:27PM +, P lerenard wrote: > 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? See perldoc -f sort. It has many fine examples of how to sort various types of

RE: sort a hash

2002-10-09 Thread P lerenard
thanks working fine >From: "Wagner, David --- Senior Programmer Analyst --- WGO" ><[EMAIL PROTECTED]> >To: 'P lerenard' <[EMAIL PROTECTED]>, [EMAIL PROTECTED] >Subject: RE: sort a hash >Date: Wed, 9 Oct 2002 15:25:23 -0500 > > Replace

RE: sort a hash

2002-10-09 Thread Mark Anderson
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; } foreac

RE: sort a hash

2002-10-09 Thread Wagner, David --- Senior Programmer Analyst --- WGO
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: Wednes

Re: Sort a hash table

2002-04-02 Thread Chris Ball
> "Michael" == Michael Stearman <[EMAIL PROTECTED]> writes: Michael> Does anyone know how to alphabetically sort the keys in a Michael> hash table? Thanks, Hi, Michael. You can find the answer to this question in 'perldoc', under the FAQ section. The command to run would be 'perld

RE: Sort a hash table

2002-04-02 Thread Nikola Janceski
uh... @sortedkeys = sort keys %HASH; remember that you can't keep the keys of %HASH sorted in %HASH, you need an array for that. > -Original Message- > From: Michael Stearman [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 02, 2002 9:19 AM > To: [EMAIL PROTECTED] > Subject: Sort a ha