in reply to .. operator and not including the condition of right operand

What should you do for qw( 0aap 2mies 0aap 1mies 2mies 0aap );? That will determine the best answer.

The Perfect is the Enemy of the Good.

Replies are listed 'Best First'.
Re^2: .. operator and not including the condition of right operand
by eXile (Priest) on Apr 27, 2005 at 18:57 UTC
    1mies should start the match, so
    mies mies
    should be printed in that case (updated the OP, to clarify)
      my $good; for (@aap) { my ($type, $value) = /^(\d)(.*)/ or next; if ( $type == 0 ) { $good = 0; next; } elsif ($type == 1) { $good = 1; } next unless $good; print "$value\n"; }
      (Untested)

      The Perfect is the Enemy of the Good.

        Though I don't doubt this sort of code works, I think he said 'more elegant', not just a working solution. He was finding fault with the use of two separate captures in the two conditions of the flipflop (..) range operator.

        --
        [ e d @ h a l l e y . c c ]