Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: perldelta unclear on 'given's fate

by morelenmir (Beadle)
on Jan 04, 2014 at 18:45 UTC ( #1069309=note: print w/replies, xml ) Need Help??


in reply to Re: perldelta unclear on 'given's fate
in thread perldelta unclear on 'given's fate

Hmmm...

I actually had to run that to work it out!

It prints "one, two, three, three, three" because the 'three' routine resets the global $_ every time the flow of execution reaches it I think? But... why doesn't the same happen with the 'two ()' routine... Something to do with the parentheses - does that sub not effect the global $_?

That's quite a mind-twister!!!

  • Comment on Re^2: perldelta unclear on 'given's fate

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2020-11-28 23:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?