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

什么是 @.在Perl?

发布时间:2020-12-15 22:03:22 所属栏目:大数据 来源:网络整理
导读:是什么 @. 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 errorprint "@.n"; # "@."
是什么 @. 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 from strict 'vars' errors.

您正在使用保留名称.你不应该期望能够依赖任何功能.

(编辑:李大同)

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

    推荐文章
      热点阅读