详细解释perl字符串变量

网络整理 - 06-27

在PERL中,字符串的末尾并不含有隐含的NULL字符,NULL字符可以出现在串的任何位置。
. 双引号内的字符串中支持简单变量替换,例如:
  $number = 11;
  $text = "This text contains the number $number.";
  则$text的内容为:"This text contains the number 11."

.双引号内的字符串中支持转义字符
Table 3.1. Escape sequences in strings.

Escape Sequence Description

\a Bell (beep)

\b Backspace

\cn The Ctrl+n character

\e Escape

\E Ends the effect of \L, \U or \Q

\f Form feed

\l Forces the next letter into lowercase

\L All following letters are lowercase

\n Newline

\r Carriage return

\Q Do not look for special pattern characters

\t Tab

\u Force next letter into uppercase

\U All following letters are uppercase

\v Vertical tab