⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 perlvaro.txt

📁 source of perl for linux application,
💻 TXT
📖 第 1 页 / 共 3 页
字号:
Thus after a match against $_, $& coincides with substr $_, $-[0], $+[0] - $-[0]. Similarly, $n coincides with substr $_, $-[n], $+[n] - $-[n] if $-[n] is defined, and $+ coincides with substr $_, $-[$#-], $+[$#-]. One can use $#- to find the last matched subgroup in the last successful match. Contrast with $#+, the number of subgroups in the regular expression. Compare with @+.This array holds the offsets of the beginnings of the last successful submatches in the currently active dynamic scope. $-[0] is the offset into the string of the beginning of the entire match. The nth element of this array holds the offset of the nth submatch, so $+[1] is the offset where $1 begins, $+[2] the offset where $2 begins, and so on. You can use $#- to determine how many subgroups were in the last successful match. Compare with the @+ variable.After a match against some variable $var:$` is the same as substr($var, 0, $-[0])$& is the same as substr($var, $-[0], $+[0] - $-[0])$' is the same as substr($var, $+[0])$1 is the same as substr($var, $-[1], $+[1] - $-[1]) $2 is the same as substr($var, $-[2], $+[2] - $-[2])$3 is the same as substr $var, $-[3], $+[3] - $-[3])format_name HANDLE EXPR$FORMAT_NAME$~The name of the current report format for the currently selected output channel. Default is the name of the filehandle. (Mnemonic: brother to $^.)format_top_name HANDLE EXPR$FORMAT_TOP_NAME$^The name of the current top-of-page format for the currently selected output channel. Default is the name of the filehandle with _TOP appended. (Mnemonic: points to top of page.)format_line_break_characters HANDLE EXPR$FORMAT_LINE_BREAK_CHARACTERS$:The current set of characters after which a string may be broken to fill continuation fields (starting with ^) in a format. Default is " \n-", to break on whitespace or hyphens. (Mnemonic: a "colon" in poetry is a part of a line.)format_formfeed HANDLE EXPR$FORMAT_FORMFEED$^LWhat formats output as a form feed. Default is \f.$ACCUMULATOR$^AThe current value of the write() accumulator for format() lines. A format contains formline() calls that put their result into $^A. After calling its format, write() prints out the contents of $^A and empties. So you never really see the contents of $^A unless you call formline() yourself and then look at it. See perlform and "formline()" in perlfunc.$CHILD_ERROR$?The status returned by the last pipe close, backtick (``) command, successful call to wait() or waitpid(), or from the system() operator. This is just the 16-bit status word returned by the wait() system call (or else is made up to look like it). Thus, the exit value of the subprocess is really ($? >> 8), and $? & 127 gives which signal, if any, the process died from, and $? & 128 reports whether there was a core dump. (Mnemonic: similar to sh and ksh.)Additionally, if the h_errno variable is supported in C, its value is returned via $? if any gethost*() function fails.If you have installed a signal handler for SIGCHLD, the value of $? will usually be wrong outside that handler.Inside an END subroutine $? contains the value that is going to be given to exit(). You can modify $? in an END subroutine to change the exit status of your program. For example:    END {        $? = 1 if $? == 255;  # die would make it 255    } Under VMS, the pragma use vmsish 'status' makes $? reflect the actual VMS exit status, instead of the default emulation of POSIX status.Also see "Error Indicators".$OS_ERROR$ERRNO$!If used numerically, yields the current value of the C errno variable, with all the usual caveats. (This means that you shouldn't depend on the value of $! to be anything in particular unless you've gotten a specific error return indicating a system error.) If used an a string, yields the corresponding system error string. You can assign a number to $! 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?)Also see "Error Indicators".$EXTENDED_OS_ERROR$^EError information specific to the current operating system. At the moment, this differs from $! under only VMS, OS/2, and Win32 (and for MacPerl). On all other platforms, $^E is always just the same as $!.Under VMS, $^E provides the VMS status value from the last system error. This is more specific information about the last system error than that provided by $!. This is particularly important when $! is set to EVMSERR.Under OS/2, $^E is set to the error code of the last call to OS/2 API either via CRT, or directly from perl.Under Win32, $^E always returns the last error information reported by the Win32 call GetLastError() which describes the last error from within the Win32 API. Most Win32-specific code will report errors via $^E. ANSI C and Unix-like calls set errno and so most portable Perl code will report errors via $!. Caveats mentioned in the description of $! generally apply to $^E, also. (Mnemonic: Extra error explanation.)Also see "Error Indicators".$EVAL_ERROR$@The Perl syntax error message from the last eval() operator. If null, the last eval() parsed and executed correctly (although the operations you invoked may have failed in the normal fashion). (Mnemonic: Where was the syntax error "at"?)Warning messages are not collected in this variable. You can, however, set up a routine to process warnings by setting $SIG{__WARN__} as described below.Also see "Error Indicators".$PROCESS_ID$PID$$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 getgroups(), one of which may be the same as the first number.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 getgroups(), one of which may be the same as the first number.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 effective gid; that is, to force an effective gid of 5 and an effectively empty setgroups() list, say  $) = "5 5" .(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$0Contains 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're running. (Mnemonic: same as sh and ksh.)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() functions. (Mnemonic: [ begins subscripts.)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$^CThe 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 $^C = 1 is similar to calling B::minus_c.$DEBUGGING$^DThe current value of the debugging flags. (Mnemonic: value of -D switch.)$SYSTEM_FD_MAX$^FThe 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 descriptors are closed before the open() is attempted.) The close-on-exec status of a file descriptor will be decided according to the value of $^F when the corresponding file, pipe, or socket was opened, not the time of the exec().$^HWARNING: 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 of the block is completed, it regains the saved value. Between the points where its value is saved and restored, code that executes within BEGIN blocks is free to change the value of $^H.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 compiled.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 }%^HWARNING: 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$^IThe current value of the inplace-edit extension. Use undef to disable inplace editing. (Mnemonic: value of -i switch.)$^MBy 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 malloc. Then    $^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$^OThe 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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -