treebeard has asked for the wisdom of the Perl Monks concerning the following question:
OK, there is a node out there called
I was wondering how the logic works with the sort? When I write
foreach $invnumctr ( sort{$inv{$a} <=> $inv{$b}} keys %inv) {how does perl know how to sort the list? How does the comparison work logically? I have included this in my code and i have solved my problem, but I feel uncomfortable not knowing what it is that the code is doing.
|
---|
Replies are listed 'Best First'. | |
---|---|
(jeffa) Re: sort keys question
by jeffa (Bishop) on Jul 19, 2001 at 02:18 UTC | |
Re: sort keys question (boo)
by boo_radley (Parson) on Jul 19, 2001 at 02:46 UTC | |
by tachyon (Chancellor) on Jul 19, 2001 at 03:27 UTC | |
Re: sort keys question
by grinder (Bishop) on Jul 19, 2001 at 02:47 UTC | |
Re: sort keys question
by buckaduck (Chaplain) on Jul 19, 2001 at 02:49 UTC | |
Re: sort keys question
by treebeard (Acolyte) on Jul 19, 2001 at 03:07 UTC |