diff --git a/pod/perlvar.pod b/pod/perlvar.pod index 559ca8ebe3e7..cd1ba6cd2984 100644 --- a/pod/perlvar.pod +++ b/pod/perlvar.pod @@ -1828,19 +1828,39 @@ Also, it's just like C<$/>, but it's what you get "back" from Perl. X<$|> X X X<$OUTPUT_AUTOFLUSH> If set to nonzero, forces a flush right away and after every write or -print on the currently selected output channel. Default is 0 -(regardless of whether the channel is really buffered by the system or -not; C<$|> tells you only whether you've asked Perl explicitly to -flush after each write). STDOUT will typically be line buffered if -output is to the terminal and block buffered otherwise. Setting this -variable is useful primarily when you are outputting to a pipe or -socket, such as when you are running a Perl program under B and -want to see the output as it's happening. This has no effect on input -buffering. See L for that. See L on -how to select the output channel. See also L. +print on the currently selected output channel. The default is 0. + +C will typically be line buffered if output is to the terminal +and block buffered otherwise. Setting this variable is useful +primarily when you are outputting to a pipe or socket. This would +come into play when you are writing to a pipe and want to see the +output "live" with no buffering. + +B + + $| = 1; # Set autoflush for current channel + $is_buf = $|; # Get the current autoflush status + + STDOUT->autoflush(1); # Enable autoflush for STDOUT + +B C<$|> tells you only if you have asked Perl explicitly to +flush after each write. It is still possible the channel may be buffered +by the system. Mnemonic: when you want your pipes to be piping hot. +B + +=over + +=item * L to pick the output channel for C<$|>. + +=item * L for more fine grained IO control. + +=item * L for information on I buffering. + +=back + =item ${^LAST_FH} X<${^LAST_FH}>