Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Use of do() to run lots of perl scripts

by afoken (Chancellor)
on Mar 03, 2021 at 18:35 UTC ( [id://11129087]=note: print w/replies, xml ) Need Help??


in reply to Re: Use of do() to run lots of perl scripts
in thread Use of do() to run lots of perl scripts

do is just a glorified eval `cat FILE` mechanism.

... without creating a sub-process and running cat, of course.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^3: Use of do() to run lots of perl scripts
by LanX (Saint) on Mar 03, 2021 at 18:37 UTC
    of course that's why I said "mechanism" and linked to the docs.

    do "./stat.pl" is largely like

    eval `cat stat.pl`;

    except that it's more concise, runs no external processes, and keeps track of the current filename for error messages. It also differs in that code evaluated with do FILE cannot see lexicals in the enclosing scope; eval STRING does.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2025-12-06 22:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (85 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.