in reply to Undefined scalar
All you have to do is put the following at the top of your script:
use warnings;
Add the following as well to report on all problems with your code:
use strict;
Warning example for undefined variable:
use warnings; use strict; my $x; print "$x\n";
Output:
Use of uninitialized value $x in concatenation (.) or string at script +.pl line 4.
strict error for undeclared variable:
use warnings; use strict; print "$y\n";
Output:
Global symbol "$y" requires explicit package name (did you forget to d +eclare "my $y"?) at script.pl line 4.
|
---|