Steampunk has asked for the wisdom of the Perl Monks concerning the following question:
Here's my code as I first wrote it:
use strict; my @list = qw (first second third fourth fifth sixth + seventh eigth ninth tenth); print (reverse (@list));
...and this presents the answer:
TENTHNINTHEIGTHSEVENTH...
Okay, this meets the "intent" of the lesson, but I wanted it tweaked so that there would be a space in between each element of the displayed list. While it didn't feel "right" to me, I simply changed the code to:
use strict; my @list = qw (first second third fourth fifth sixth + seventh eigth ninth tenth); print (reverse (@list) . " ");
This got me a totally unexpected:
HTNETHTNINHTGIEHTNEVES...
Wow! Not my expectation at all! So, this leads to:
Thanks, everyone. And if this was posted to the wrong area, please let me know. A swift slap to the head usually gets my attention.
-- Just another Perl slacker
Steampunk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(kudra: printing reverse list answer) Re: A simple
by kudra (Vicar) on Oct 04, 2000 at 16:31 UTC | |
|
Re: A simple
by kilinrax (Deacon) on Oct 04, 2000 at 16:35 UTC | |
|
Re: A simple
by swiftone (Curate) on Oct 04, 2000 at 18:14 UTC | |
|
Re: A simple
by clemburg (Curate) on Oct 04, 2000 at 16:37 UTC | |
by Jouke (Curate) on Oct 04, 2000 at 17:07 UTC | |
by clemburg (Curate) on Oct 04, 2000 at 17:44 UTC | |
|
Thanks!
by Steampunk (Scribe) on Oct 04, 2000 at 20:25 UTC | |
by kudra (Vicar) on Oct 04, 2000 at 20:39 UTC |