in reply to Re: Re: flip-flop operator and sequence number
in thread flip-flop operator and sequence number

That code doesn't do the same.
#!/opt/perl/bin/perl -wl use strict; my @data = qw /foo start bar baz stop qux start quux stop fuzzle/; foreach (grep /start/ .. /stop/, @data) { next if /start/ || /stop/; print } print "----"; foreach (sub {pop; shift; @_} -> (grep /start/ .. /stop/, @data)) { print; } __END__ bar baz quux ---- bar baz stop start quux
You are losing the boundaries of the flip-flop operator, and use the boundaries of grep. But those boundary events are not necessarely the same.

-- Abigail

Replies are listed 'Best First'.
Re: Re: flip-flop operator and sequence number
by John M. Dlugosz (Monsignor) on Jun 28, 2001 at 19:48 UTC
    That's a good point. But your code is not the same either, since his original said last not next. He was stopping after the first group and ignoring a subsequent /start/.