Literals
时间:2008-01-17 来源:xiaoaizhen
Numeric: 123 1_234 123.4 5E-10 0xff (hex) 0377 (octal) String: 'abc' literal string, no variable interpolation or escape characters, except \' and \\. Also: q/abc/. Almost any pair of delimiters can be used instead of /.../. "abc" Variables are interpolated and escape sequences are processed. Also: qq/abc/.
Escape sequences: \t (Tab), \n (Newline), \r (Return), \f (Formfeed), \b (Backspace), \a (Alarm), \e (Escape), \033 (octal), \x1b (hex), \c[ (control)
\l and \u lowercase/uppercase the following character. \L and \U lowercase/uppercase until a \E is encountered. \Q quote regular expression characters until a \E is encountered. `COMMAND` evaluates to the output of the COMMAND. Also: qx/COMMAND/. Array: (1, 2, 3). () is an empty array.
(1..4) is the same as (1,2,3,4),
likewise ('a'..'z').
qw/foo bar .../ is the same as ('foo','bar',...). Array reference: [1,2,3] Hash (associative array): (KEY1, VAL1, KEY2, VAL2,...)
Also (KEY1=> VAL1, KEY2=> VAL2,...) Hash reference: {KEY1, VAL1, KEY2, VAL2,...} Code reference: sub {STATEMENTS} Filehandles: <STDIN>, <STDOUT>, <STDERR>, <ARGV>, <DATA>.
User-specified: HANDLE, $VAR. Globs: <PATTERN> evaluates to all filenames according to the pattern. Use <${VAR}> or glob $VAR to glob from a variable. Here-Is: <<IDENTIFIER
Shell-style "here document." Special tokens: __FILE__: filename; __LINE__: line number; __END__: end of program; remaining lines can be read using the filehandle DATA.
Escape sequences: \t (Tab), \n (Newline), \r (Return), \f (Formfeed), \b (Backspace), \a (Alarm), \e (Escape), \033 (octal), \x1b (hex), \c[ (control)
\l and \u lowercase/uppercase the following character. \L and \U lowercase/uppercase until a \E is encountered. \Q quote regular expression characters until a \E is encountered. `COMMAND` evaluates to the output of the COMMAND. Also: qx/COMMAND/. Array: (1, 2, 3). () is an empty array.
(1..4) is the same as (1,2,3,4),
likewise ('a'..'z').
qw/foo bar .../ is the same as ('foo','bar',...). Array reference: [1,2,3] Hash (associative array): (KEY1, VAL1, KEY2, VAL2,...)
Also (KEY1=> VAL1, KEY2=> VAL2,...) Hash reference: {KEY1, VAL1, KEY2, VAL2,...} Code reference: sub {STATEMENTS} Filehandles: <STDIN>, <STDOUT>, <STDERR>, <ARGV>, <DATA>.
User-specified: HANDLE, $VAR. Globs: <PATTERN> evaluates to all filenames according to the pattern. Use <${VAR}> or glob $VAR to glob from a variable. Here-Is: <<IDENTIFIER
Shell-style "here document." Special tokens: __FILE__: filename; __LINE__: line number; __END__: end of program; remaining lines can be read using the filehandle DATA.
相关阅读 更多 +
排行榜 更多 +