Turns out flip-flops maintain their state even across subroutine callsNot if closures are involved:
sub mk_flipflop { my ($start, $end) = @_; return sub { /$start/../$end/ } } for my $fh (@fhs) { my $ff = mk_flipflop(qr/^PP_START$/, qr/^PP_END$/); while (<$fh>) { $ff->() or next; # process line } }
In reply to Re^3: Resetting a flip-flop operator
by runrig
in thread Resetting a flip-flop operator
by AppleFritter
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |