ruzam has asked for the wisdom of the Perl Monks concerning the following question:
I would expect the following results:my @keys = qw( 3242_38 2313_44 3242_37 3518_38 3242_49 3518_44 ); map { print "$_\n" } reverse @keys;
But instead I get:3518_44 3518_38 3242_49 3242_38 3242_37 2313_44
Which is neither sorted forward or reverse or the original order. If I change 'reverse' to 'sort' I get perfectly good sorted output. So why does 'reverse' put the wammy on my results? I must be missing something incredably simple here :(3518_44 3242_49 3518_38 3242_37 2313_44 3242_38
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sort/reverse strangeness
by moritz (Cardinal) on Oct 29, 2007 at 17:24 UTC | |
by Fletch (Bishop) on Oct 29, 2007 at 17:39 UTC | |
by ikegami (Patriarch) on Oct 29, 2007 at 17:52 UTC | |
by ysth (Canon) on Oct 30, 2007 at 05:23 UTC | |
|
Re: sort/reverse strangeness
by Anonymous Monk on Oct 29, 2007 at 17:24 UTC |