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 %comp;
> >

I have tried that, but it gave me an error telling that $year is undefined.
$year should be a variable but the sort function should loop through all
the years for every code of all the companies, and return the biggest
profit.

That's why I think I need to use a second hash that uses the code of the
companies as a hash key and the profit as its values.

Teddy


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to