ranjan_jajodia has asked for the wisdom of the Perl Monks concerning the following question:
The above code throws the following (expected) error :use strict; if (@_) { my $var = "ok"; } print "$var\n";
But, example 2:Global symbol "$var" requires explicit package name at test2.pl line 6 +. Execution of test2.pl aborted due to compilation errors.
does not.use strict; my $var = "ok" if (@_); print "$var\n";
|
|---|