Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: The Behavior of 'do'

by PrakashK (Pilgrim)
on Jul 26, 2001 at 23:00 UTC ( #100090=note: print w/replies, xml ) Need Help??

in reply to The Behavior of 'do'

I am not well versed with the way perl parser works. But I took the help of Deparse backend and this is what it revealed.
>> perl -MO=Deparse -e 'do ("print")' do 'print'; -e syntax OK >> perl -MO=Deparse -e 'do (print)' do print($_); -e syntax OK >> perl -MO=Deparse -e 'do print' do 'print'; -e syntax OK >> perl -MO=Deparse -e 'do{print}' print $_;; -e syntax OK
do expects a BLOCK, SUBROUTINE (deprecated) or an EXPR as its argument. So, I am guessing that, when a BLOCK or SUBROUTINE is not passed, it is looking for an expression and probably allowing barewords.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2016-10-27 06:23 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (353 votes). Check out past polls.