Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by morelenmir (Beadle)
on Jan 04, 2014 at 18:45 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1069309]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-18 08:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found