源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

perl中的$a和$b介绍

  • 时间:2021-11-02 04:43 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:perl中的$a和$b介绍
即使打开了strict和warnings选项也无妨,下面代码并无错误和警告。
[u]复制代码[/u] 代码如下:
#!/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.
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部