in reply to Re^2: Resetting a flip-flop operator
in thread Resetting a flip-flop operator

Turns out flip-flops maintain their state even across subroutine calls
Not 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 } }

Replies are listed 'Best First'.
Re^4: Resetting a flip-flop operator
by RonW (Parson) on Aug 06, 2015 at 15:19 UTC