Re: strict behavior with .pm



On 9/28/07, Jeremy Kister <perl-04@xxxxxxxxxxxxxxxx> wrote:
Given the below code, is there something that will warn/prevent me from
declaring $variable when i really meant @variable ?
snip
package My::Example;
sub new {
return bless({}, shift);
}
sub go {
my $variable;
push @variable, 1;
return(\@int);
}
1;
snip

The strict pragma is lexically scoped, so you need to use it again
after the package statement. It is probably a good idea to turn on
warnings as well.
.



Relevant Pages