Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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.
Comment on Re: The Behavior of 'do'
Download Code

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 studying the Monastery: (2)
As of 2016-05-29 02:05 GMT
Find Nodes?
    Voting Booth?