Why the followig code is not working.
My son, let me give you some priestly advice:
When you want to find out why something isn't working you
first have to establish for the reader what your criteria
for "working" is. In other words: what were
you expecting to happen, and what really happened.
As has been noted before and I quote from the perldoc
In list context, returns a list value consisting of the
ments of LIST in the opposite order. In scalar context
catenates the elements of LIST and returns a string val
all characters in the opposite order.
print reverse <>; # line tac, last line f
undef $/; # for efficiency of <>
print scalar reverse <>; # character tac, last l
So with that in mind, if I run the following on-liner:
perl -e 'print scalar reverse "dog" . "\n";'
I get the following terse output:
Let us play... If I run the following one liner:
perl -e 'print join( ",", reverse ( split "", "dog")) . "\n";'
I am now feeding reverse an array and I can now get the
I hope this clears things up for you....
Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||