Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: What is the difference between eval and do?

by ELISHEVA (Prior)
on Feb 19, 2011 at 21:36 UTC ( #889106=note: print w/ replies, xml ) Need Help??


in reply to What is the difference between eval and do?

Note: I wrote this and only after realized that I didn't read eliya's answer carefully enough. Consider this an amplification of his final paragraph.

There is a very nice summary of the difference in the documentation for do - see the second example for do EXPR.

One of the biggest differences is that the code run by eval can "see" the value of my variables in the code surrounding it. When do "some file" executes the code in a file, that code lives in its own world and cannot access those variables.


Comment on Re: What is the difference between eval and do?
Select or Download Code
Replies are listed 'Best First'.
Re^2: What is the difference between eval and do?
by AGhoulDoingPerl (Sexton) on Feb 20, 2011 at 05:41 UTC
    and this too, thanks:)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (13)
As of 2015-07-30 13:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls