Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Read a variable backwards..

by johngg (Canon)
on Jan 06, 2014 at 13:03 UTC ( [id://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

Replies are listed 'Best First'.
Re^2: Read a variable backwards..
by moritz (Cardinal) on Jan 06, 2014 at 18:32 UTC
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"; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-18 20:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found