in reply to PUZZLED
You have to initialize $i.$direction = 1; #set to -1 to go to opposite direction @array = split(//, $string); for (@array) { print $array[$i]; $i = ($i + $direction) % ($#array + 1); };
UPDATED: Added $direction (I think I was going backwards first)
|
|---|