手机
当前位置:查字典教程网 >脚本专栏 >perl >perl中的$a和$b介绍
perl中的$a和$b介绍
摘要:即使打开了strict和warnings选项也无妨,下面代码并无错误和警告。复制代码代码如下:#!/usr/bin/perlusestric...

即使打开了strict和warnings选项也无妨,下面代码并无错误和警告。

复制代码 代码如下:

#!/usr/bin/perl

use strict;

use warnings;

sub test {

$a = 1;

$b = 2;

print $a, "n";

print $b, "n";

}

test();

1;

下面是perl文档中对这两个变量的解释:

perldoc perlvar

$a

$b Special package variables when using sort(), see "sort" in perlfunc.

Because of this specialness $a and $b don't need to be declared (using use vars, or our()) even when using the "strict 'vars'" pragma. Don't lexicalize them with "my $a" or "my $b" if you want to be able to use them in the sort() comparison block or function.

【perl中的$a和$b介绍】相关文章:

Perl的Mail::POP3Client模块和Gmail通信实例

perl产生随机数实现代码

perl处理csv文件的小例子

perl的cgi高级编程介绍

perl后门,正向和反向!实例代码

perl中chomp的使用介绍(chop和chomp函数区别)

perl用变量做句柄介绍

perl哈希hash的常见用法介绍

用Perl操作Excel文档的实例代码

perl大文件读取处理的模块介绍

精品推荐
分类导航