in reply to Re^3: sort direction
in thread sort direction
True, but then there are no guarentees that sort will produce consistant result if you do weird things with overload:
perl> use overload '""' => sub{ rand }, fallback => 1;; perl> @n = map{ bless \$_ } 1 .. 10;; perl> print $$_ for sort{ $a <=> $b } @n;; 10 9 8 4 5 3 7 6 2 1 perl> print $$_ for sort{ $b <=> $a } @n;; 10 5 4 6 3 9 7 8 1 2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: sort direction
by ysth (Canon) on Oct 10, 2005 at 05:39 UTC | |
by BrowserUk (Patriarch) on Oct 10, 2005 at 07:28 UTC | |
by ysth (Canon) on Oct 10, 2005 at 09:56 UTC |