Why is there no error issued by strict
:
use strict;
$a = $a + 1;
$a and $b are special globals used by sort
, so they're always defined. Try it with $c instead and you will get an error.
Although strict
does not complain about the special $a
and $b
variables,
perlcritic will detect their usage:
Magic variables should be assigned as "local"... (Severity: 4)
$a
is a special global variable. It doesn't need to be declared. See perldoc perlvar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With