Felix Geerinckx wrote at Wed, 29 May 2002 17:17:38 +0200:
> on Wed, 29 May 2002 16:10:40 GMT, [EMAIL PROTECTED] (Janek Schleicher) wrote:
>
>> Oops, there's a typo :-((
>>
>> Of course, I meant
>> @sorted = reverse sort { $myhash{$a} <=> $myhash{b} } keys %myhash;
>
> There's another typo.
Ye
Please remove me from email list. thanks.
--- Felix Geerinckx <[EMAIL PROTECTED]>
wrote:
> on Wed, 29 May 2002 12:58:33 GMT,
> [EMAIL PROTECTED] (Craig
> Hammer) wrote:
>
> > I thought this would work:
>
> Your code is very buggy:
>
>
> > @sorted = sort { $myhash{$b} <=> $myhash{a} } keys
on Wed, 29 May 2002 16:10:40 GMT, [EMAIL PROTECTED] (Janek
Schleicher) wrote:
> Oops, there's a typo :-((
>
> Of course, I meant
> @sorted = reverse sort { $myhash{$a} <=> $myhash{b} } keys %myhash;
There's another typo.
And I'd rather add
# sort keys in descending numerical order
th
Janek Schleicher wrote at Wed, 29 May 2002 17:20:02 +0200:
> Make it more readable and write:
>
> @sorted = reverse sort { $myhash{$b} <=> $myhash{b} } keys %myhash;
Oops, there's a typo :-((
Of course, I meant
@sorted = reverse sort { $myhash{$a} <=> $my
Janek, et al --
...and then Janek Schleicher said...
%
% Craig Hammer wrote at Wed, 29 May 2002 14:58:33 +0200:
%
...
% > @sorted = sort { $myhash{$b} <=> $myhash{a} } keys %myhash ;
...
%
% You want to sort decreasingly, from the highest to the lowest.
...
% Make it more readable and write:
%
Craig Hammer wrote at Wed, 29 May 2002 14:58:33 +0200:
> I've found a couple of examples of moving an array into a hash, but not of moving a
>hash into an
> array.
>
> I thought this would work:
>
> @sorted = sort { $myhash{$b} <=> $myhash{a} } keys %myhash ;
>
I'd like to give another hint,
Thank you Felix and Bob. I see I was approaching this compeltely wrong.
Craig Hammer
-Original Message-
From: Felix Geerinckx [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 8:23 AM
To: [EMAIL PROTECTED]
Subject: Re: converting a hash to an array
on Wed, 29 May 2002 12:58:33
on Wed, 29 May 2002 12:58:33 GMT, [EMAIL PROTECTED] (Craig
Hammer) wrote:
> I thought this would work:
Your code is very buggy:
> @sorted = sort { $myhash{$b} <=> $myhash{a} } keys %myhash ;
This should read:
@sorted = sort { $myhash{$b} <=> $myhash{$a} } keys %myhash ;
> -Original Message-
> From: Craig Hammer [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 29, 2002 5:59 AM
> To: Perl (E-mail)
> Subject: converting a hash to an array
>
>
> I've found a couple of examples of moving an array into a
> hash, but not
, Harry [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 8:05 AM
To: '[EMAIL PROTECTED]'
Subject: RE: converting a hash to an array
> -Original Message-
> From: Craig Hammer [mailto:[EMAIL PROTECTED]]
>
> @sorted = sort { $myhash{$b} <=&g
> -Original Message-
> From: Craig Hammer [mailto:[EMAIL PROTECTED]]
>
> @sorted = sort { $myhash{$b} <=> $myhash{a} } keys %myhash ;
^
*
COLT Telecommu
I've found a couple of examples of moving an array into a hash, but not of
moving a hash into an array.
I thought this would work:
@sorted = sort { $myhash{$b} <=> $myhash{a} } keys %myhash ;
while ( <@sorted> ) {
printf ( "first field = %s second field = %s\n", $sorted{1}, $sorted{2}
) ;
12 matches
Mail list logo