http://qs1969.pair.com?node_id=737701


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