欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

perl中的$a和$b介紹

 更新時間:2013年02月09日 23:47:22   作者:  
有關(guān)perl中的$a和$b,這兩個變量是為sort函數(shù)準(zhǔn)備的內(nèi)置變量,所以聲明時可以不加 my

即使打開了strict和warnings選項也無妨,下面代碼并無錯誤和警告。

復(fù)制代碼 代碼如下:

#!/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.

相關(guān)文章

最新評論