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

源码网商城

perl use vars pragma使用技巧

  • 时间:2020-12-11 12:18 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:perl use vars pragma使用技巧
perl 中的vars是perl中的一个pragma(预编译指示符),专门用来预定义全局变量,这些预定义后的全局变量在qw()列表中,在整个引用perl文件中皆可使用,即便使用use strict也不会报错:
[u]复制代码[/u] 代码如下:
use strict ; $str = "hello world!\n" ;
报错信息:Global symbol "$str" requires explicit package name at ~vars.pl line 3. Execution of ~vars.pl aborted due to complication errors. 引用use vars后执行结果:
[u]复制代码[/u] 代码如下:
use strict ; use vars qw($str) ; $str = "hello world!\n" ; print $str ;
Output : hello world!
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部