in reply to reverse is not reversing
You need scalar context for string reverse
print scalar reverse $test;
What's happening is that the one element list is reversed now, which is of course useless.
DB<5> print reverse qw/a1 b2 c3/ # inverting list c3b2a1 DB<6> print scalar reverse qw/a1 b2 c3/ # inverting string 3c2b1a
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
added code
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: reverse is not reversing
by badbanana (Novice) on Nov 26, 2018 at 15:17 UTC | |
by choroba (Cardinal) on Nov 26, 2018 at 15:21 UTC | |
by LanX (Saint) on Nov 26, 2018 at 15:32 UTC | |
by tobyink (Canon) on Nov 26, 2018 at 19:12 UTC | |
by LanX (Saint) on Nov 26, 2018 at 19:18 UTC | |
by LanX (Saint) on Nov 26, 2018 at 15:21 UTC |