Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^5: Playing with non-localized $_ in nested loops.

by gaal (Parson)
on Aug 23, 2004 at 11:35 UTC ( [id://385056]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Playing with non-localized $_ in nested loops.
in thread Playing with non-localized $_ in nested loops.

The aliasing is local to the scope of these constructs, so why is it confusing things to say that the constructs localize $_?

Replies are listed 'Best First'.
Re^6: Playing with non-localized $_ in nested loops.
by Aristotle (Chancellor) on Aug 23, 2004 at 15:44 UTC

    Because it isn't localizing, which creates an entirely isolated new thing for $_ to refer to. It's binding, in which $_ takes on the role of another scalar. The results of modifying $_ inside an aliasing construct persist past that construct, even if not in $_. When you localize it, the result is forever lost after the block. local creates an isolated reality; the aliasing constructs do not.

    Makeshifts last the longest.

      Ah, that's a good explanation. Thanks!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-03-19 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found