So you want an env that works in a DWIM manner? How should it detect whether it was invoked from command line or from shebang? Note that it is the OS that passes a single argument to env. To rectify this, you'd have to change the way OS behaves.
FWIW, Linux supports custom executable formats (binfmt_misc). You could actually hack up a fancy ld-linux.so that is shebang capable, and arrange this to handle your scripts as well. But then you'd have to decide how to parse/split the argument string: just split it at whitespace, or use shell escaping rules? Which shell? All in all, that's a horrible can of worms, which is probably why the shebang is as it is today.
If you absolutely need a perl environment that is predictable and reliable, then the program path is the least of your worries. You'd most likely bundle your own perl and modules in that case, and know the path of your binaries.
|Replies are listed 'Best First'.|
Re^6: shebang anomaly
by perlboy_emeritus (Sexton) on Apr 20, 2018 at 20:33 UTC