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

Re: #!/usr/bin/perl vs. -*- perl -*-

by QM (Parson)
on Jan 20, 2009 at 22:16 UTC ( #737701=note: print w/replies, xml ) Need Help??


in reply to #!/usr/bin/perl vs. -*- perl -*-

For casual scripts, I've always used the following:
eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}' && eval 'exec perl -w -S $0 $argv:q' if 0; # The above invocation finds perl in the path, wherever it may be
(I've forgotten where I stole this from.)

Is there a "best" way to get whichever perl is in your path?

I hadn't seen the env version before, nice.

I also agree, in many cases the shebang line should point to a fixed Perl. I can even see an argument for not giving any shebang hints, and always invoking the perl binary explicitly from an external source.

-QM
--
Quantum Mechanics: The dreams stuff is made of

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2023-06-06 10:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (26 votes). Check out past polls.

    Notices?