in reply to Re^2: Skipping Elements in an Array
in thread Skipping Elements in an Array

Problems:
  1. The array is called @Array, not @_.
  2. Modifying an array you're looping over isn't well defined.
  3. It will attempt to skip over 2 elements for all strings less than 3 characters, not just strings of exactly 2 characters.

Replies are listed 'Best First'.
Re^4: Skipping Elements in an Array
by sh1tn (Priest) on Apr 07, 2005 at 14:24 UTC
    my @Array = ('AAA','BB','CCCC','DD','EEEEE','FFF','GGGG'); my @Skipped = split' ..( \S+){3}',"@Array"; print "@Skipped" __END__ STDOUT: AAA EEEEE FFF GGGG Right?


      That would fail if the strings contain spaces.