Re: The $a have any special meanning ?



"sonet" <sonet.all@xxxxxxxxxxxxx> wrote in message news:f64n0b$d1h$1@xxxxxxxxxxxxxxxxxxxx
1.pl
----------------------
use strict;
$a=1;

the perl does not return error (Global symbol "$a" requires explicit package name...)

but

2.pl
----------------------
use strict;
$c=1;

the perl return error (Global symbol "$c" requires explicit package name...)

$a and $b are special reserved variables used in sorting. perldoc -f sort

You can use them, but it is not good practice.

In fact single letter variable names are rarely good practice, particularly when you need to re-edit that code in a years time...

P

.



Relevant Pages

  • Re: help: having trouble evaluating expressions with EVAL
    ... on "use strict" I get a bunch of new errors. ... Global symbol "$exp" requires explicit package name at ...
    (comp.lang.perl.misc)
  • use of our variable causes compilation errors
    ... Use of reserved word "our" is deprecated at dfw.pl line 22. ... Global symbol "$ErrorMessage" requires explicit package name at dfw.pl ... because the system default perl executable was in v5.005_03, ...
    (comp.lang.perl.misc)
  • Re: why does this script not work?
    ... #use strict; ... Global symbol "$email" requires explicit package name ... Putting aside the error message because of the global symbol, ...
    (comp.lang.perl.misc)
  • Re: help: having trouble evaluating expressions with EVAL
    ... on "use strict" I get a bunch of new errors. ... my ($str, $exp, $answer); ... Global symbol "$exp" requires explicit package name at ...
    (comp.lang.perl.misc)
  • Re: Global symbol "$var1" requires explicit
    ... # Since you are use strict you must declare all variables before using # ... Global symbol "$var1" requires explicit package name at sample.pl line 3. ... Global symbol "$var2" requires explicit package name at sample.pl line 4. ...
    (perl.beginners)