Perl predefined Variables

Source: Internet
Author: User
Tags deprecated perl interpreter perl script
Perl has many built-in variables and columns for searching.

$ 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 timed med 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
Print operator simply prints out the comma-separated fields you
Specify, with no trailing newline or record separator assumed.
$ List_separator
$"
-This is like ''' $, ''' does t 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 multidimen=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
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,
All the usual caveats. If used in a string context, yields
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, doesn't 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.
$ Inclutive_user_id
$ EUID
$>-The specified tive uid of this process.
$ Real_group_id
$ GID
$ (-The real gid of this process.
$ Paitive_group_id
$ EGID
$)
-The specified tive 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 encoded by 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 varous signals. Example:
$ ^ M-Emergency Memory Pool

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.