in reply to Dev Hashbang

One way is to use #!/usr/bin/env perl which takes the first perl binary found in the $PATH environment variable. Then you have to tweak $PATH to point to the correct perl first on each platform.

Replies are listed 'Best First'.
Re^2: Dev Hashbang
by almut (Canon) on Feb 19, 2010 at 14:35 UTC

    env is generally fine, but note that in this case you can't pass any arguments on the shebang line, because most kernels do split/pass everything after env as one argument.  For example

    #!/usr/bin/env perl -w ...

    would produce (on Linux)

    $ ./824155.pl /usr/bin/env: perl -w: No such file or directory

      Good point! particularily on a web server (as per the OP), where you want taint checks:

      !#/usr/bin/perl -T
      pl2bat
      eval 'exec perl -x -S "$0" ${1+"$@"}' if 0; # In case running under some shell
      Easier to install with MakeMaker
Re^2: Dev Hashbang
by FunkyMonk (Bishop) on Feb 19, 2010 at 14:54 UTC
    +1

    Thank you so much for that moritz. I've often wondered what env was for - its manpage does not do it justice. I'd given up trying to get bash to just run the perl it finds in $PATH.