Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^10: "my" declaration problem

by shmem (Chancellor)
on Apr 25, 2017 at 21:50 UTC ( [id://1188917]=note: print w/replies, xml ) Need Help??


in reply to Re^9: "my" declaration problem
in thread "my" declaration problem

How is it possible that $atexit holds 2 objects which are both destroyed at scopes end?

Because there are 2 $atexit variables - a masked one, and a masking one created later.

This is all to fullfill what hath been written:

"my" variable $var masks earlier declaration in same scope

Since it masks that variable - and does not replace it since this would mean destroying the current my variable of that name, the scope of the masked variable ends when the masking ends - because the scope of the masking variable ends - which is: at scope end.

IMHO this is not an implementation specific detail, but part of the the design of my and perl scopes, thus part of the language.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-25 20:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found