Pod-Simple
view release on metacpan or search on metacpan
t/perlvaro.txt view on Meta::CPAN
$$
The process number of the Perl running this script. You should consider this variable read-only, although it will be altered across fork() calls. (Mnemonic: same as shells.)
$REAL_USER_ID
$UID
$<
The real uid of this process. (Mnemonic: it's the uid you came from, if you're running setuid.)
$EFFECTIVE_USER_ID
$EUID
$>
The effective uid of this process. Example:
$< = $>; # set real to effective uid
($<,$>) = ($>,$<); # swap real and effective uid
(Mnemonic: it's the uid you went to, if you're running setuid.) $< and $> can be swapped only on machines supporting setreuid().
$REAL_GROUP_ID
$GID
$(
The real gid of this process. If you are on a machine that supports membership in multiple groups simultaneously, gives a space separated list of groups you are in. The first number is the one returned by getgid(), and the subsequent ones by getgroup...
However, a value assigned to $( must be a single number used to set the real gid. So the value given by $( should not be assigned back to $( without being forced numeric, such as by adding zero.
(Mnemonic: parentheses are used to group things. The real gid is the group you left, if you're running setgid.)
$EFFECTIVE_GROUP_ID
$EGID
$)
The effective gid of this process. If you are on a machine that supports membership in multiple groups simultaneously, gives a space separated list of groups you are in. The first number is the one returned by getegid(), and the subsequent ones by ge...
Similarly, a value assigned to $) must also be a space-separated list of numbers. The first number sets the effective gid, and the rest (if any) are passed to setgroups(). To get the effect of an empty list for setgroups(), just repeat the new effect...
(Mnemonic: parentheses are used to group things. The effective gid is the group that's right for you, if you're running setgid.)
$<, $>, $( and $) can be set only on machines that support the corresponding set[re][ug]id() routine. $( and $) can be swapped only on machines supporting setregid().
$PROGRAM_NAME
$0
Contains the name of the program being executed. On some operating systems assigning to $0 modifies the argument area that the ps program sees. This is more useful as a way of indicating the current program state than it is for hiding the program you...
Note for BSD users: setting $0 does not completely remove "perl" from the ps(1) output. For example, setting $0 to "foobar" will result in "perl: foobar (perl)". This is an operating system feature.
$[
The index of the first element in an array, and of the first character in a substring. Default is 0, but you could theoretically set it to 1 to make Perl behave more like awk (or Fortran) when subscripting and when evaluating the index() and substr()...
As of release 5 of Perl, assignment to $[ is treated as a compiler directive, and cannot influence the behavior of any other file. Its use is highly discouraged.
$]
The version + patchlevel / 1000 of the Perl interpreter. This variable can be used to determine whether the Perl interpreter executing a script is in the right range of versions. (Mnemonic: Is this version of perl in the right bracket?) Example:
warn "No checksumming!\n" if $] < 3.019;
See also the documentation of use VERSION and require VERSION for a convenient way to fail if the running Perl interpreter is too old.
The use of this variable is deprecated. The floating point representation can sometimes lead to inaccurate numeric comparisons. See $^V for a more modern representation of the Perl version that allows accurate string comparisons.
$COMPILING
$^C
The current value of the flag associated with the -c switch. Mainly of use with -MO=... to allow code to alter its behavior when being compiled, such as for example to AUTOLOAD at compile time rather than normal, deferred loading. See perlcc. Setting...
$DEBUGGING
$^D
The current value of the debugging flags. (Mnemonic: value of -D switch.)
$SYSTEM_FD_MAX
$^F
The maximum system file descriptor, ordinarily 2. System file descriptors are passed to exec()ed processes, while higher file descriptors are not. Also, during an open(), system file descriptors are preserved even if the open() fails. (Ordinary file ...
$^H
WARNING: This variable is strictly for internal use only. Its availability, behavior, and contents are subject to change without notice.
This variable contains compile-time hints for the Perl interpreter. At the end of compilation of a BLOCK the value of this variable is restored to the value when the interpreter started to compile the BLOCK.
When perl begins to parse any block construct that provides a lexical scope (e.g., eval body, required file, subroutine body, loop body, or conditional block), the existing value of $^H is saved, but its value is left unchanged. When the compilation ...
This behavior provides the semantic of lexical scoping, and is used in, for instance, the use strict pragma.
The contents should be an integer; different bits of it are used for different pragmatic flags. Here's an example:
sub add_100 { $^H |= 0x100 }
sub foo {
BEGIN { add_100() }
bar->baz($boon);
}
Consider what happens during execution of the BEGIN block. At this point the BEGIN block has already been compiled, but the body of foo() is still being compiled. The new value of $^H will therefore be visible only while the body of foo() is being co...
Substitution of the above BEGIN block with:
BEGIN { require strict; strict->import('vars') }
demonstrates how use strict 'vars' is implemented. Here's a conditional version of the same lexical pragma:
BEGIN { require strict; strict->import('vars') if $condition }
%^H
WARNING: This variable is strictly for internal use only. Its availability, behavior, and contents are subject to change without notice.
The %^H hash provides the same scoping semantic as $^H. This makes it useful for implementation of lexically scoped pragmas.
$INPLACE_EDIT
$^I
The current value of the inplace-edit extension. Use undef to disable inplace editing. (Mnemonic: value of -i switch.)
$^M
By default, running out of memory is an untrappable, fatal error. However, if suitably built, Perl can use the contents of $^M as an emergency memory pool after die()ing. Suppose that your Perl were compiled with -DPERL_EMERGENCY_SBRK and used Perl's...
$^M = 'a' x (1 << 16);
would allocate a 64K buffer for use in an emergency. See the INSTALL file in the Perl distribution for information on how to enable this option. To discourage casual use of this advanced feature, there is no English long name for this variable.
$OSNAME
$^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 $Config{'osname'}. See also Config and the -V command-line switch documented in perlrun.
$PERLDB
$^P
The internal variable for debugging support. The meanings of the various bits are subject to change, but currently indicate:
0x01
Debug subroutine enter/exit.
0x02
Line-by-line debugging.
0x04
Switch off optimizations.
0x08
Preserve more data for future interactive inspections.
0x10
Keep info about source lines on which a subroutine is defined.
0x20
Start with single-step on.
0x40
Use subroutine address instead of name when reporting.
0x80
Report goto &subroutine as well.
0x100
Provide informative "file" names for evals based on the place they were compiled.
0x200
Provide informative names to anonymous subroutines based on the place they were compiled.
Some bits may be relevant at compile-time only, some at run-time only. This is a new mechanism and the details may change.
$LAST_REGEXP_CODE_RESULT
$^R
The result of evaluation of the last successful (?{ code }) regular expression assertion (see perlre). May be written to.
$EXCEPTIONS_BEING_CAUGHT
$^S
Current state of the interpreter. Undefined if parsing of the current module/eval is not finished (may happen in $SIG{__DIE__} and $SIG{__WARN__} handlers). True if inside an eval(), otherwise false.
$BASETIME
$^T
The time at which the program began running, in seconds since the epoch (beginning of 1970). The values returned by the -M, -A, and -C filetests are based on this value.
$PERL_VERSION
$^V
The revision, version, and subversion of the Perl interpreter, represented as a string composed of characters with those ordinals. Thus in Perl v5.6.0 it equals chr(5) . chr(6) . chr(0) and will return true for $^V eq v5.6.0. Note that the characters...
This can be used to determine whether the Perl interpreter executing a script is in the right range of versions. (Mnemonic: use ^V for Version Control.) Example:
warn "No \"our\" declarations!\n" if $^V and $^V lt v5.6.0;
See the documentation of use VERSION and require VERSION for a convenient way to fail if the running Perl interpreter is too old.
See also $] for an older representation of the Perl version.
$WARNING
$^W
The current value of the warning switch, initially true if -w was used, false otherwise, but directly modifiable. (Mnemonic: related to the -w switch.) See also warnings.
${^WARNING_BITS}
The current set of warning checks enabled by the use warnings pragma. See the documentation of warnings for more details.
${^WIDE_SYSTEM_CALLS}
Global flag that enables system calls made by Perl to use wide character APIs native to the system, if available. This is currently only implemented on the Windows platform.
( run in 1.850 second using v1.01-cache-2.11-cpan-5735350b133 )