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

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.

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://889106]
and the universe expands...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2018-05-26 10:24 GMT
Find Nodes?
    Voting Booth?