Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Resetting a flip-flop operator

by runrig (Abbot)
on Aug 06, 2015 at 14:53 UTC ( [id://1137694]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-23 17:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found