是什么 @. perl中的变量?
它看起来是一个特殊的,可写的全局,并且(令人惊讶地)不会在双引号字符串中进行插值:
use strict; use warnings; # Under 5.8,5.10,5.12,5.14,and 5.16,# the following lines produce: @. = (3,2,1); # no error print "@.\n"; # "@." print @.,"\n"; # "321" eval 'my @.; 1' # Can't use global @. in "my" at (eval 1) or die $@; # line 1,near "my @."
我记不起曾经遇到它,并没有在perlvar和perldata中看到它.
解决方法
perldoc perlvar州:
Perl variable names may also be a sequence of digits or a single punctuation or control character. These names are all reserved for special uses by Perl;
和
Perl identifiers that begin with digits,control characters,or punctuation characters are exempt from the effects of the package declaration and are always forced to be in
package main
; they are also exempt fromstrict 'vars'
errors.