in reply to sort keys question
Now that that's out of the way, let's break things down.(Apple=>10, Peach=>5, Berry=>9, Cobbler=>3, Cherry=>7 )
(Apple, Peach, Berry, Cobbler, Cherry)
and so on. The important thing to remember is that it's still using just the keys to sort on! By the time all is said and done, sort knows that Cobbler's value is less than Peach's value is less than Cherry's value is less than Berry's value is less than Apple's value (no puns, please), and that's what gets passed to foreach. see sort for the full perldoc version, and perlop for the scoop on the spaceship operator.$inv{Apple} <=> $inv{Peach} $inv{Peach} <=> $inv{Berry} $inv{Peach} <=> $inv{Cobbler} ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: sort keys question (boo)
by tachyon (Chancellor) on Jul 19, 2001 at 03:27 UTC |