Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Read a variable backwards..

by johngg (Abbot)
on Jan 06, 2014 at 13:03 UTC ( #1069507=note: print w/ replies, xml ) Need Help??


in reply to Read a variable backwards..

You could use chop if you don't need to retain the string.

$ perl -E ' $str = q{abcdefg}; say chop $str while $str;' g f e d c b a $

I hope this is helpful.

Cheers,

JohnGG


Comment on Re: Read a variable backwards..
Download Code
Re^2: Read a variable backwards..
by littlemonk (Sexton) on Jan 06, 2014 at 16:18 UTC

    check this code

    $str="123456789"; @arr=split(//,$str); while($tmp=pop(@arr)){ print "\nfirst-frm last-->$tmp"; }
Re^2: Read a variable backwards..
by moritz (Cardinal) on Jan 06, 2014 at 18:32 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1069507]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2014-07-25 12:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (171 votes), past polls