in reply to Is local a declaration?
So:
UPDATE: I originally posted that my $var was equivalent to $Test::var. That is incorrect however, I've since learned that lexical variables are not package variables at all. I offer as proof:#!/usr/bin/perl package Test; use strict; my $var;
'local' on the other hand does not actually initialize variables, and certainly does nothing to fully qualify the variable name with a package.package Amel; use strict; $Amel::var = "Dan"; my $var = "Balaban"; print $Amel::var, " $var\n";
As far as the error goes:
Global symbol "$var" requires explicit package name at - line 3.
But just so you understand:
#!/usr/bin/perl use strict; $main::var = "string"; print $main::var, "\n";
Amel - f.k.a. - kel
|
|---|