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"; }