in reply to accessing variable vaule outside for loop

This session under the debugger shows two possible ways of doing what you want.

DB<1> @c = (1,2,3,4); DB<2> for ($i = $#c; $i>=0;$i--) {push @d, $c[$i]}; DB<3> x @d 0 4 1 3 2 2 3 1 DB<4> unshift @e, $_ for @c; DB<5> x @e 0 4 1 3 2 2 3 1

Replies are listed 'Best First'.
Re^2: accessing variable vaule outside for loop
by gaurav (Sexton) on Jul 06, 2013 at 12:29 UTC

    Thank you @Laurent R ,you help me out.And thanks to others for their valuable suggestion