in reply to Getting the next array element while still keeping the current one

The natural way of processing arrays in Perl is very direct, compared to the Pascal/Java focus on de-referencing arrays.

for my $elem ( @array ) { # do something with $elem }

It's worth taking a few moments to see if what you are trying to achieve can be implemented in this style. Some code doesn't fit nicely into the pattern, so using indices becomes necessary. But when it works, the direct style is both more efficient, and clearer to read: do XYZ with each element of the array, instead of getting hung up on implementation details.

--
TTTATCGGTCGTTATATAGATGTTTGCA

  • Comment on Re: Getting the next array element while still keeping the current one
  • Download Code