Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^4: How do I use 'which' in the hash-bang line? (updated)

by Anonymous Monk
on Mar 15, 2018 at 18:46 UTC ( [id://1210982] : note . print w/replies, xml ) Need Help??


in reply to Re^3: How do I use 'which' in the hash-bang line? (updated x2)
in thread How do I use 'which' in the hash-bang line?

Try:

$ chmod a+x test.pl $ ./test.pl

The env utility *supports* passing arguments to the command .... if invoked from command line (with args split by shell). As part of shebang, however, all following arguments are passed to env as a single string. So if you don't have a command such as "perl -wls" on the $PATH, the result is a failure.

Replies are listed 'Best First'.
Re^5: How do I use 'which' in the hash-bang line?
by haukex (Archbishop) on Mar 15, 2018 at 20:01 UTC
    As part of shebang, however, all following arguments are passed to env as a single string.

    That's a very good point, I've edited my post, thanks.