加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

perl 常用内置 变量 速查表

发布时间:2020-12-15 20:52:09 所属栏目:大数据 来源:网络整理
导读:$-? --?? 当前页可打印的行数,属于Perl格式系统的一部分 $!? --?? 根据上下文内容返回错误号或者错误串 $"? --?? 列表分隔符 $#? --?? 打印数字时默认的数字输出格式 $? --?? Perl解释器的进程ID $%? --?? 当前输出通道的当前页号 $Content$amp;? --?? 与上

$-? --?? 当前页可打印的行数,属于Perl格式系统的一部分

$!? --?? 根据上下文内容返回错误号或者错误串

$"? --?? 列表分隔符

$#? --?? 打印数字时默认的数字输出格式

$? --?? Perl解释器的进程ID

$%? --?? 当前输出通道的当前页号

$Content$amp;? --?? 与上个格式匹配的字符串

$(? --?? 当前进程的组ID

$)? --?? 当前进程的有效组ID

$*? --?? 设置1表示处理多行格式.现在多以/s和/m修饰符取代之.

$,? --?? 当前输出字段分隔符

$.? --?? 上次阅读的文件的当前输入行号

$/? --?? 当前输入记录分隔符,默认情况是新行

$:? --?? 字符设置,此后的字符串将被分开,以填充连续的字段.

$;? --?? 在仿真多维数组时使用的分隔符.

$?? --?? 返回上一个外部命令的状态

$@? --?? Perl解释器从eval语句返回的错误消息

$[? --?? 数组中第一个元素的索引号

$/? --?? 当前输出记录的分隔符

$]? --?? Perl解释器的子版本号

$^? --?? 当前通道最上面的页面输出格式名字

$^A? --?? 打印前用于保存格式化数据的变量

$^D? --?? 调试标志的值

$^E? --?? 在非UNIX环境中的操作系统扩展错误信息

$^F? --?? 最大的文件捆述符数值

$^H? --?? 由编译器激活的语法检查状态

$^I? --?? 内置控制编辑器的值

$^L? --?? 发送到输出通道的走纸换页符

$^M? --?? 备用内存池的大小

$^O? --?? 操作系统名

$^P? --?? 指定当前调试值的内部变量

$^R? --?? 正则表达式块的上次求值结果

$^S? --?? 当前解释器状态

$^T? --?? 从新世纪开始算起,脚步本以秒计算的开始运行的时间

$^W? --?? 警告开关的当前值

$^X? --?? Perl二进制可执行代码的名字

$_? --?? 默认的输入/输出和格式匹配空间

$? --?   控制对当前选择的输出文件句柄的缓冲

$~? --?? 当前报告格式的名字

?

?

?

?

?

perl预定义变量

$ARG
$_
- The default input and pattern-searching space.
$<digit> - Contains the subpattern from the corresponding set of parentheses in the last pattern matched.
$MATCH
$&
- The string matched by the last successful pattern match.
$PREMATCH
$`
- The string preceding whatever was matched by the last successful pattern match.
$POSTMATCH
$'
- The string following whatever was matched by the last successful pattern match.
$LAST_PAREN_MATCH
$+
- The last bracket matched by the last search pattern.
$MULTILINE_MATCHING
$*
- Set to 1 to do multi-line matching within a string,0 to tell Perl that it can assume that strings contain a single line,for the purpose of optimizing pattern matches. Default is 0. Use of ``$*'' is deprecated in modern perls.
input_line_number HANDLE EXPR
$INPUT_LINE_NUMBER
$NR
$.
- The current input line number for the last file handle from which you read (or performed a seek or tell on).
input_record_separator HANDLE EXPR
$INPUT_RECORD_SEPARATOR
$RS
$/
- The input record separator,newline by default.
autoflush HANDLE EXPR
$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.
output_field_separator HANDLE EXPR
$OUTPUT_FIELD_SEPARATOR
$OFS
$,
- The output field separator for the print operator.
output_record_separator HANDLE EXPR
$OUTPUT_RECORD_SEPARATOR
$ORS
$/
- The output record separator for the print operator. Ordinarily the print operator simply prints out the comma-separated fields you specify,with no trailing newline or record separator assumed.
$LIST_SEPARATOR
$"
- This is like ``$,'' except that it applies to array values interpolated into a double-quoted string (or similar interpreted string). Default is a space.
$SUBSCRIPT_SEPARATOR
$SUBSEP
$;
- The subscript separator for multidimensional array emulation.
$OFMT
$#
- The output format for printed numbers. Use of ``$#'' is deprecated.
format_page_number HANDLE EXPR
$FORMAT_PAGE_NUMBER
$%
- The current page number of the currently selected output channel.
format_lines_per_page HANDLE EXPR
$FORMAT_LINES_PER_PAGE
$=
- The current page length (printable lines) of the currently selected output channel. Default is 60.
format_lines_left HANDLE EXPR
$FORMAT_LINES_LEFT
$-
- The number of lines left on the page of the currently selected output channel.
format_name HANDLE EXPR
$FORMAT_NAME
$~
- The name of the current report format for the currently selected output channel. Default is name of the filehandle.
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 name of the filehandle with _TOP appended.
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.
format_formfeed HANDLE EXPR
$FORMAT_FORMFEED
$^L
- What formats output to perform a form feed. Default is /f.
$ACCUMULATOR
$^A
- The current value of the write() accumulator for format() lines.
$CHILD_ERROR
$?
- The status returned by the last pipe close,backtick (``) command,or system() operator.
$OS_ERROR
$ERRNO
$!
- If used in a numeric context,yields the current value of errno,with all the usual caveats. If used in a string context,yields the corresponding system error string.
$EXTENDED_OS_ERROR
$^E
- More specific information about the last system error than that provided by $!,if available. (If not,it's just $! again,except under OS/2.)
$EVAL_ERROR
$@
- The Perl syntax error message from the last eval() command.
$PROCESS_ID
$PID
$$
- The process number of the Perl running this script.
$REAL_USER_ID
$UID
$<
- The real uid of this process.
$EFFECTIVE_USER_ID
$EUID
$>
- The effective uid of this process.
$REAL_GROUP_ID
$GID
$(
- The real gid of this process.
$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.
$PROGRAM_NAME
- Contains the name of the file containing the Perl script being executed.
$[ - The index of the first element in an array,and of the first character in a substring. As of Perl 5,assignment to ``$['' is treated as a compiler directive,and cannot influence the behavior of any other file. Its use is discouraged.
$PERL_VERSION
$]
- The version + patchlevel / 1000 of the Perl interpreter.
$DEBUGGING
$^D
- The current value of the debugging flags.
$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.
$^H - The current set of syntax checks enabled by use strict.
$INPLACE_EDIT
$^I
- The current value of the inplace-edit extension.
$OSNAME
$^O
- The name of the operating system under which this copy of Perl was built,as determined during the configuration process.
$PERLDB
$^P
- The internal variable for debugging support.
$BASETIME
$^T
- The time at which the script began running.
$WARNING
$^W
- The current value of the warning switch.
$EXECUTABLE_NAME
$^X
- The name that the Perl binary itself was executed as,from C's argv[0].
$ARGV - contains the name of the current file when reading from <>.
@ARGV - The array @ARGV contains the command line arguments intended for the script.
@INC - The array @INC contains the list of places to look for Perl scripts to be evaluated by the do EXPR,require,or use constructs.
%INC - The hash %INC contains entries for each filename that has been included via do or require.
$ENV - The hash %ENV contains your current environment. Setting a value in ENV changes the environment for child processes.
$SIG - The hash %SIG is used to set signal handlers for various signals. Example:
$^M -emergency memory pool

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读