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

My [update: broken] entry:
(/^..$/...$_)||print for@Array # 30 chars, with named array

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^4: Skipping Elements in an Array
by Anonymous Monk on Apr 07, 2005 at 14:10 UTC
    my @Array = ('AAA','BB','CCCC','DD','EEEEE','FFF','GGGG'); (/^..$/...$_)||print for@Array; __END__ AAAFFFGGGG
    But according to the OP, it should not exclude the 'EEEEE'. Your solution excludes the entry that has 2 characters, and the next one (or rather, until the next one that is true). The result of your program will change if you replace 'CCCC' with '0', or 'DD' with 'DDD'.
Re^4: Skipping Elements in an Array
by sh1tn (Priest) on Apr 07, 2005 at 14:12 UTC
    Please, recheck your code - it is skipping more elements.

    Another 31 chars:
    print split' ..( \S+){3}',"@_"


      28, using the @_ instead of @Array (otherwise 32):
      ($.=/^..$/...2)||print for@_
      Save another char by changing ... to .., but you get a warning.

      Caution: Contents may have been coded under pressure.
        Another (two) chars cut
        $.=/^..$/..2or print for@_