Re: local and auto flush

2018-05-29 Thread Brandon McCaig
On Tue, May 15, 2018 at 06:02:40PM +0100, Andrew Solomon wrote: > $| is a global* variable so you use local to isolate this > change to only where you need it. Just to expand on this idea, this is called "dynamic scope"[1] (as opposed to global or local scope). Effectively a new scope is allocated

Re: local and auto flush

2018-05-19 Thread perl
Many thanks for the very helpful comments from Andrew and Andy. For the first time, I have a clear idea of what local and auto flushing are doing for me. I know I’d get educated here! -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.or

Re: local and auto flush

2018-05-15 Thread Andy Bach
> I vaguely understand that local restricts the auto flushing, though I’m not sure how. Does local go out of scope when the TT is called? More broadly, do I actually need local? Do I actually need auto flushing? It basically creates a "local" copy of the global var - local meaning the current lexi

Re: local and auto flush

2018-05-15 Thread Andrew Solomon
Hi Rick, Regarding "local": $| is a global* variable so you use local to isolate this change to only where you need it. To see what I mean, run this: print "step1: $| \n"; { local $| = 1; print "step2: $| \n"; } print "step3: $| \n"; and you'll get output: step1: 0 step2: 1 st