"The problem is, that the 'my $item' declaration only happens if the '$self->grid($x, $y)' call actually returns something."
There is some gap in this explaination, as $self->grid($x, $y) is before that and operator, obviously it returns first. If what you said was true, then at the time you go evaluate what's after that and operator, $item is already there, and there should be no problem.
This really has nothing to do with the actual execution of the code, but rather the way, the interpreter parses the code.
In reply to Re^2: Scoping question
by pg
in thread Scoping question
by Dr. Mu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |