Michael G Schwern <schwern@pobox.com> writes: > And people say local() isn't good for anything anymore... > > sub bar { > local $| = 1; > quux(42); > # more stuff which works in the unbuff. > } > > sub quux { > my $fourty_two = shift; > local $| = 1; > # enquux it > } > > By using local() to dynamically scope a copy of $| you provide > buffering with a good nesting instinct. However, you don't protect > yourself from rougue routines you call mucking with your copy of $| > (for instance, if quux() did C<$| = 1> instead of C<local $| = 1> > you'd be screwed. And, of course, local $| is restored the original value *whenever* the block is exited, not just whenever I remember to restore it. I sit corrected. > [...bondage & discipline in Perl snipped...] Of course, incrementing and decrementing is 25% faster... GD&R'ily yours, -- Ariel Scolnicov ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe