Harry Putnam wrote:
>
> "John W. Krahn" <[EMAIL PROTECTED]> writes:
> >
> > And then get the sorted list like this:
> >
> > @sorted = sort { $name{ $a } cmp $name{ $b } } keys %name;
>
> I've seen that in books and stuff but was never able to fathom out
> how it does what it does. So never actually used it in code.
> I still don't see how it does what it does but at least an up close
> and personal example of what it does.... Thanks
"keys %name" passes a list of the keys from the %name hash to sort.
Inside the sort code block the $a and $b variables contain the current
keys to be sorted and we use those keys to reference the current values
of %name and sort those. Then the list of keys sorted by values is
stored in the @sorted array.
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]