Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Scoping question

by Wonko the sane (Deacon)
on Nov 03, 2004 at 20:38 UTC ( #404990=note: print w/ replies, xml ) Need Help??


in reply to Scoping question

Hello

The problem is, that the 'my $item' declaration only happens if the '$self->grid($x, $y)'
call actually returns something.
Other wise, there is no 'my' declaration, so you get the error stating that the
'$item' var is not known about.

Hope that helps
Wonko

Update: I stand corrected. Thank you pg

Replies are listed 'Best First'.
Re^2: Scoping question
by pg (Canon) on Nov 03, 2004 at 20:49 UTC
    "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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://404990]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2016-06-26 16:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (330 votes). Check out past polls.