Re: Semcarlbd letrtes sepur! (Scrambled letters super!)
Kripa Sundar <[email protected]>
| Newsgroups | gmane.comp.lang.perl.fun |
|---|---|
| Message-ID | <[email protected]> |
=> * Kripa Sundar <[email protected]> [2003-09-18 15:41]: => > The following does guarantee re-ordering. => => How does it reorder "loop"? :-) That's easy. It re-orders it as "loop". :-) To see the difference between "loop" and "loop", one has to be in the loop. Or loopy. :-) Anyway, to satisfy the sceptics (and, of course, for ObPerl) here is a one-liner that shows the difference, using sort(): || % perl -le '$, = ", "; @x = qw(loop loop); \ || &ps(@x); &ps(reverse @x); sub ps {print sort @_}' || loop, loop || loop, loop || % Clearly, sort() swaps "loop" with "loop" in the first invocation, but in the second invocation, "loop" already precedes "loop". :-) peace, || Rescuing good ideas: Micro venture capital: --{kr.pA} || http://tinyurl.com/gjpd -- "I promise you I will listen to what has been said here, even though \ I wasn't here." -- George W. Bush [http://slate.msn.com/?id=76886]