Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: conditional self-execution

by gam3 (Curate)
on Jan 28, 2008 at 03:24 UTC ( #664617=note: print w/replies, xml ) Need Help??


in reply to conditional self-execution

It all seems to work:
do "q.pl"; # prints module
./q.pl # prints script
# q.pl if (__FILE__ eq $0) { print "script\n"; } else { print "module\n"; }
-- gam3
A picture is worth a thousand words, but takes 200K.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2018-09-19 00:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Eventually, "covfefe" will come to mean:













    Results (163 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!