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

Try that with
my @aap = qw(1one two three four 0stop done);
The difference between the two-dot and three-dot forms is merely that the RHS will not be evaluated on the same pass as the LHS for the three-dot form. Your expression guarantees that a line beginning with 1 and any following lines beginning with 0 will be printed, plus one line that doesn't begin with 0.

Caution: Contents may have been coded under pressure.
  • Comment on Re^2: .. operator and not including the condition of right operand
  • Download Code

Replies are listed 'Best First'.
Re^3: .. operator and not including the condition of right operand
by sh1tn (Priest) on Apr 27, 2005 at 20:09 UTC
    ... if( /^1/ ... /^(0.*)/ ) { $1 and next; print "$_\n"; } ...


      That will work except when $1 is 0 (which it can be). The three-dot form isn't making a difference in results here, although I suppose it saves some pattern matching. I'd do
      if((/^1/ ... /^0/) =~ /^\d+$/ ){
      although in this case
      if(/^1/ ... (/^0/ && next)){
      works rather neatly.

      Caution: Contents may have been coded under pressure.