$|(dollar sign and pipe symbol) or
$OUTPUT_AUTOFLUSH. This variable is used to control forcing a flush on a filehandle, be it
STDOUT, a disk file, pipe or socket. For example, to perform non-buffered I/O to the screen, we would do the following:
A few examples of some of the variables I use the most are listed below:
(Mnemonic: underline is understood in certain operations.)
STDOUTwill 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, such as when you are running a Perl script under rsh and want to see the output as it's happening. (Mnemonic: when you want your pipes to be piping hot.)
$!" to be anything in particular unless you've gotten a specific error return indicating a system error.) If used in a string context, yields the corresponding system error string. You can assign to "
$!" in order to set errno if, for instance, you want "
$!" to return the string for error n, or you want to set the exit value for the
die()operator. (Mnemonic: What just went bang?)
$0" modifies the argument area that the
ps(1)program sees. This is more useful as a way of indicating the current program state than it is for hiding the program you're running. (Mnemonic: same as sh and ksh.)
@ARGVcontains the command line arguments intended for the script. Note that
$#ARGVis the generally number of arguments minus one, since
$ARGVis the first argument, NOT the command name. See "
$0" for the command name.
@INCcontains the list of places to look for Perl scripts to be evaluated by the
useconstructs. It initially consists of the arguments to any
-Icommand line switches, followed by the default Perl library, probably "
/usr/local/lib/perl", followed by ".", to represent the current directory.
%INCcontains entries for each filename that has been included via
require. The key is the filename you specified, and the value is the location of the file actually found. The
requirecommand uses this array to determine whether a given file has already been included.
%ENVcontains your current environment. Setting a value in
ENVchanges the environment for child processes.