Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^4: What's the "...0" mean?

by lidden (Curate)
on Oct 15, 2010 at 22:56 UTC ( #865581=note: print w/ replies, xml ) Need Help??

in reply to Re^3: What's the "...0" mean?
in thread What's the "...0" mean?

The part before the dots turns the flip flop operator to true, the part after sets it to false when it matches.

An example of how the flip flop operator works.

my @array = qw- 1 2 3 on 4 5 off 6 7 8 on 9 10 11 12 off 13 14 15 -; for (@array){ say if /on/ ... /off/; }
Update: Added example.

Comment on Re^4: What's the "...0" mean?
Download Code
Replies are listed 'Best First'.
Re^5: What's the "...0" mean?
by morgon (Deacon) on Oct 15, 2010 at 23:24 UTC
    That is a good example.

    But in the original question

    perl -ne 'print if s/.*?(?=abc)//...2' input.txt
    the flip-flop is true on the first line (the substitution) and remains to be true on the second line (the comparison with line number).

    But should it then not remain false for the rest of the file resulting in no more lines being printed?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://865581]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2015-11-25 08:47 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (672 votes), past polls