perl中的$a和$b介绍

时间:2022-06-15 00:30:07 

即使打开了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
0
投稿

猜你喜欢

  • opencv python截取圆形区域的实现

    2022-11-27 06:58:50
  • 在Django model中设置多个字段联合唯一约束的实例

    2021-02-09 22:04:59
  • python特效之字符成像详解

    2021-06-07 02:18:45
  • Flask模板引擎之Jinja2语法介绍

    2021-11-15 21:08:11
  • Django实现支付宝付款和微信支付的示例代码

    2021-01-31 10:16:29
  • Python带动态参数功能的sqlite工具类

    2022-10-02 14:05:15
  • asp 取一个数的整数 但不是四舍五入,只要有小数,就取大于这个数的整数

    2011-03-17 10:34:00
  • 详解tensorflow训练自己的数据集实现CNN图像分类

    2023-02-28 10:47:04
  • Django中modelform组件实例用法总结

    2023-09-28 14:35:49
  • Python 中的lambda函数介绍

    2022-06-15 18:33:04
  • Python字节单位转换实例

    2023-07-18 07:09:16
  • MySQL 基本概念

    2011-09-10 16:22:34
  • ASP用csDrawGraph组件制作饼图、柱状图

    2008-04-25 22:58:00
  • 对于Python异常处理慎用“except:pass”建议

    2023-01-30 02:30:44
  • php中去除所有js,html,css代码

    2023-07-08 07:59:52
  • python元组的概念知识点

    2022-01-03 19:29:19
  • 详解Python中的正则表达式的用法

    2023-07-25 00:23:13
  • pytorch geometric的GNN、GCN的节点分类方式

    2022-12-24 16:01:23
  • 解决python 两个时间戳相减出现结果错误的问题

    2023-01-18 17:41:44
  • PHP CURL CURLOPT参数说明(curl_setopt)

    2023-11-14 19:06:44
  • asp之家 网络编程 m.aspxhome.com