John Macdonald writes: > As an array index -1 and 0 give you the 2 ends. The perl5 > code to alternately extract elements from the two eds of an > array can be something like: > > my $end = 0; # -1 to start with right end > > while( @array ) { > my $next = splice( @array, $end, 1 ); > # use the $next element > $end = -1 - $end; > } > > Using int1 for $end, that last line can be changed in a variety > of ways, such as: > > $end ^= 1;
Well, if you're golfing: $end++; If the low level types wrap around rather than promote; Luke