Variables declared with 'my' only become visible after the current statement has finished (ie. ended with ';'). Thus, under strictures, you must declare the variable on at least the statement before you use it.
I would probably use:
my $item = $self->grid($x, $y); push @{$self->{'select'}}, $item if $item;
In reply to Re: Scoping question
by Mutant
in thread Scoping question
by Dr. Mu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |