perl 中的vars是perl中的一個pragma(預編譯指示符),專門用來預定義全局變量,這些預定義后的全局變量在qw()列表中,在整個引用perl文件中皆可使用,即便使用use strict也不會報錯:
報錯信息:Global symbol "$str" requires explicit package name at ~vars.pl line 3.
Execution of ~vars.pl aborted due to complication errors.
引用use vars后執行結果:
Output :
hello world!
新聞熱點
疑難解答