in reply to Re^3: Pearls (not really) of Perl programming
in thread Pearls (not really) of Perl programming
code block given to sort must behave (as POD stays.)
Namely, once f(a,b) return false f(b,a) must return true.
Some versions of perl dumped core when fed some misbehaving comparision sub.
Such core dumps were fixed, but general rule remain: comparision sub must behave
This means that sort {rand(5) <=> rand(5)} is obviously wrong, but sort {1} also not good.
Best regards,
Courage, the Cowardly Dog
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Pearls (not really) of Perl programming
by htoug (Deacon) on Dec 01, 2004 at 18:49 UTC | |
by Courage (Parson) on Dec 01, 2004 at 23:35 UTC | |
|
Re^5: Pearls (not really) of Perl programming
by ysth (Canon) on Dec 01, 2004 at 16:49 UTC |