Octavian Rasnita wrote:
Gunnar Hjalmarsson wrote:
You don't need another hash.
perldoc -f sort
perldoc -q "sort a hash"
my @codes = sort {
$comp{$a}{$year}{profit}
<=>
$comp{$b}{$year}{profit}
} keys %comp;
I have tried that, but it gave me an error
From: "Gunnar Hjalmarsson" <[EMAIL PROTECTED]>
> >> You don't need another hash.
> >>
> >> perldoc -f sort
> >> perldoc -q "sort a hash"
> >>
> >> my @codes = sort {
> >> $comp{$a}{$year}{profit}
> >> <=>
> >> $comp{$b}{$year}{profit}
> >> } keys %
11:57am, Octavian Rasnita wrote:
> Hi all,
>
> I have a hash that have multiple sub hashes and I want to sort it by a sub
> key.
>
> For example, I have:
>
> $comp{$code}{$year}{profit}.
>
> And I want to sort the $code values after the value of the "profit" key.
>
> Is this possible directly, or
Aben Siatris wrote:
DÅa Tuesday 28 September 2004 11:42 Gunnar Hjalmarsson napÃsal:
Octavian Rasnita wrote:
I have a hash that have multiple sub hashes and I want to sort
it by a sub key.
For example, I have:
$comp{$code}{$year}{profit}.
And I want to sort the $code values after the value of the
"p
DÅa Tuesday 28 September 2004 11:42 Gunnar Hjalmarsson napÃsal:
> Octavian Rasnita wrote:
> > I have a hash that have multiple sub hashes and I want to sort it
> > by a sub key.
> >
> > For example, I have:
> >
> > $comp{$code}{$year}{profit}.
> >
> > And I want to sort the $code values after th
Octavian Rasnita wrote:
I have a hash that have multiple sub hashes and I want to sort it
by a sub key.
For example, I have:
$comp{$code}{$year}{profit}.
And I want to sort the $code values after the value of the "profit"
key.
Is this possible directly, or I will need to create another hash
for doi
Hi all,
I have a hash that have multiple sub hashes and I want to sort it by a sub
key.
For example, I have:
$comp{$code}{$year}{profit}.
And I want to sort the $code values after the value of the "profit" key.
Is this possible directly, or I will need to create another hash for doing
this typ
Octavian Rasnita wrote at Fri, 07 Jun 2002 21:54:02 +0200:
> I want to make a script that sorts the values from a hash.
my @sorted_values = sort {$a <=> $b} values %hash;
>
> I want to make a "top with the most downloaded files".
>
> I know how to sort the hash by keys but I couldn't sort it
Hi all,
I want to make a script that sorts the values from a hash.
I want to make a "top with the most downloaded files".
I know how to sort the hash by keys but I couldn't sort it by values.
I have a hash like:
%hash = (
file1 => 3,
file2 => 11,
file3 => 6,
fileN => 22
);
I would like