most of the methods do nothing to the current value, except for
autoflush(), which will assume a 1 for you, just to be different.
-A few of these variables are considered "read-only". This means that if you
-try to assign to this variable, either directly or indirectly through
-a reference. If you attempt to do so, you'll raise a run-time exception.
+A few of these variables are considered "read-only". This means that if
+you try to assign to this variable, either directly or indirectly through
+a reference, you'll raise a run-time exception.
=over 8
chop
chop($_)
+Here are the places where Perl will assume $_ even if you
+don't use it:
+
+=over 3
+
+=item *
+
+Various unary functions, including functions like ord() and int(), as well
+as the all file tests (C<-f>, C<-d>) except for C<-t>, which defaults to
+STDIN.
+
+=item *
+
+Various list functions like print() and unlink().
+
+=item *
+
+The pattern matching operations C<m//>, C<s///>, and C<tr///> when used
+without an C<=~> operator.
+
+=item *
+
+The default iterator variable in a C<foreach> loop if no other
+variable is supplied.
+
+=item *
+
+The implicit iterator variable in the grep() and map() functions.
+
+=item *
+
+The default place to put an input record when a C<E<lt>FHE<gt>>
+operation's result is tested by itself as the sole criterion of a C<while>
+test. Note that outside of a C<while> test, this will not happen.
+
+=back
+
(Mnemonic: underline is understood in certain operations.)
+=back
+
+=over 8
+
=item $<I<digit>>
Contains the subpattern from the corresponding set of parentheses in
=item $.
-The current input line number of the last filehandle that was read.
-This variable should be considered read-only.
-Remember that only an explicit close on the filehandle
-resets the line number. Since "C<E<lt>E<gt>>" never does an explicit close, line
-numbers increase across ARGV files (but see examples under eof()).
-(Mnemonic: many programs use "." to mean the current line number.)
+The current input line number for the last file handle from
+which you read (or performed a C<seek> or <tell> on). An
+explicit close on a filehandle resets the line number. Since
+"C<E<lt>E<gt>>" never does an explicit close, line numbers increase
+across ARGV files (but see examples under eof()). Localizing C<$.> has
+the effect of also localizing Perl's notion of "the last read
+filehandle". (Mnemonic: many programs use "." to mean the current line
+number.)
=item input_record_separator HANDLE EXPR
=item $/
The input record separator, newline by default. Works like B<awk>'s RS
-variable, including treating blank lines as delimiters if set to the
-null string. You may set it to a multicharacter string to match a
+variable, including treating empty lines as delimiters if set to the
+null string. (Note: An empty line can not contain any spaces or
+tabs.) You may set it to a multicharacter string to match a
multi-character delimiter. Note that setting it to C<"\n\n"> means
something slightly different than setting it to C<"">, if the file
-contains consecutive blank lines. Setting it to C<""> will treat two or
-more consecutive blank lines as a single blank line. Setting it to
-C<"\n\n"> will blindly assume that the next input character belongs to the
-next paragraph, even if it's a newline. (Mnemonic: / is used to
+contains consecutive empty lines. Setting it to C<""> will treat two
+or more consecutive empty lines as a single empty line. Setting it to
+C<"\n\n"> will blindly assume that the next input character belongs to
+the next paragraph, even if it's a newline. (Mnemonic: / is used to
delimit line boundaries when quoting poetry.)
undef $/;
=item $|
If set to nonzero, forces a flush after every write or print on the
-currently selected output channel. Default is 0. Note that 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, 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.)
+currently selected output channel. Default is 0 (regardless of whether
+the channel is actually buffered by the system or not; C<$|> only tells
+you whether you've asked Perl to explicitly flush after each write).
+Note that 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, such as when you are running
+a Perl script under rsh and want to see the output as it's happening. This
+has no effect on input buffering.
+(Mnemonic: when you want your pipes to be piping hot.)
=item output_field_separator HANDLE EXPR
The output format for printed numbers. This variable is a half-hearted
attempt to emulate B<awk>'s OFMT variable. There are times, however,
when B<awk> and Perl have differing notions of what is in fact
-numeric. Also, the initial value is %.20g rather than %.6g, so you
-need to set "C<$#>" explicitly to get B<awk>'s value. (Mnemonic: # is the
-number sign.)
+numeric. The initial value is %.I<n>g, where I<n> is the value
+of the macro DBL_DIG from your system's F<float.h>. This is different from
+B<awk>'s default OFMT setting of %.6g, so you need to set "C<$#>"
+explicitly to get B<awk>'s value. (Mnemonic: # is the number sign.)
Use of "C<$#>" is deprecated in Perl 5.
string for error I<n>, or you want to set the exit value for the die()
operator. (Mnemonic: What just went bang?)
+=item $EXTENDED_OS_ERROR
+
+=item $^E
+
+More specific information about the last system error than that
+provided by C<$!>, if available. (If not, it's just C<$!> again.)
+At the moment, this differs from C<$!> only under VMS, where it
+provides the VMS status value from the last system error. The
+caveats mentioned in the description of C<$!> apply here, too.
+(Mnemonic: Extra error explanation.)
+
+
=item $EVAL_ERROR
=item $@
invoked may have failed in the normal fashion). (Mnemonic: Where was
the syntax error "at"?)
+Note that warning messages are not collected in this variable. You can,
+however, set up a routine to process warnings by setting $SIG{__WARN__} below.
+
=item $PROCESS_ID
=item $PID
Note: "C<$E<lt>>", "C<$E<gt>>", "C<$(>" and "C<$)>" can only be set on machines
that support the corresponding I<set[re][ug]id()> routine. "C<$(>" and "C<$)>"
-can only be swapped on machines supporting setregid().
+can only be swapped on machines supporting setregid(). Because Perl doesn't
+currently use initgroups(), you can't set your group vector to multiple groups.
=item $PROGRAM_NAME
=item $]
-The string printed out when you say C<perl -v>. It can be used to
+The string printed out when you say C<perl -v>.
+(This is currently I<BROKEN>).
+It can be used to
determine at the beginning of a script whether the perl interpreter
executing the script is in the right range of versions. If used in a
numeric context, returns the version + patchlevel / 1000. Example:
status of a file descriptor will be decided according to the value of
C<$^F> at the time of the open, not the time of the exec.
+=item $^H
+
+The current set of syntax checks enabled by C<use strict>. See the
+documentation of C<strict> for more details.
+
=item $INPLACE_EDIT
=item $^I
The current value of the inplace-edit extension. Use C<undef> to disable
inplace editing. (Mnemonic: value of B<-i> switch.)
+=item $OSNAME
+
+=item $^O
+
+The name of the operating system under which this copy of Perl was
+built, as determined during the configuration process. The value
+is identical to C<$Config{'osname'}>.
+
=item $PERLDB
=item $^P
The internal flag that the debugger clears so that it doesn't debug
-itself. You could conceivable disable debugging yourself by clearing
+itself. You could conceivably disable debugging yourself by clearing
it.
=item $BASETIME
=item $^W
-The current value of the warning switch, either TRUE or FALSE. (Mnemonic: related to the
-B<-w> switch.)
+The current value of the warning switch, either TRUE or FALSE.
+(Mnemonic: related to the B<-w> switch.)
=item $EXECUTABLE_NAME
The array @INC contains the list of places to look for Perl scripts to
be evaluated by the C<do EXPR>, C<require>, or C<use> constructs. It
initially consists of the arguments to any B<-I> command line switches,
-followed by the default Perl library, probably "/usr/local/lib/perl",
-followed by ".", to represent the current directory.
+followed by the default Perl library, probably F</usr/local/lib/perl>,
+followed by ".", to represent the current directory. If you need to
+modify this at runtime, you should use the C<use lib> pragma in order
+to also get the machine-dependent library properly loaded:
+
+ use lib '/mypath/libdir/';
+ use SomeMod;
=item %INC
The one marked scary is problematic because it's a bareword, which means
sometimes it's a string representing the function, and sometimes it's
going to call the subroutine call right then and there! Best to be sure
-and quote it or take a reference to it. *Plumber works too. See <perlsubs>.
+and quote it or take a reference to it. *Plumber works too. See L<perlsubs>.
+
+Certain internal hooks can be also set using the %SIG hash. The
+routine indicated by $SIG{__WARN__} is called when a warning message is
+about to be printed. The warning message is passed as the first
+argument. The presence of a __WARN__ hook causes the ordinary printing
+of warnings to STDERR to be suppressed. You can use this to save warnings
+in a variable, or turn warnings into fatal errors, like this:
+
+ local $SIG{__WARN__} = sub { die $_[0] };
+ eval $proggie;
+
+The routine indicated by $SIG{__DIE__} is called when a fatal exception
+is about to be thrown. The error message is passed as the first
+argument. When a __DIE__ hook routine returns, the exception
+processing continues as it would have in the absence of the hook,
+unless the hook routine itself exits via a C<goto>, a loop exit, or a die().
+The __DIE__ handler is explicitly disabled during the call, so that you
+can die from a __DIE__ handler. Similarly for __WARN__.
=back
-