in reply to #!perl Question

Not sure if this answers your question, but the following will find Perl in your path, wherever it is (as long as it's not Windows). (I'm not sure who the original author was.)
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 #(as + long as it's not Windows) # # For Windows, use something like: # # ASSOC .pl=PerlScript # FTYPE PerlScript=perl.exe %1 %* #
I haven't come across a completely generic shebang that works on both Windows and *nix.

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

Replies are listed 'Best First'.
Re^2: #!perl Question
by Anonymous Monk on Oct 04, 2005 at 04:36 UTC
    Interesting, but I have to know where perl is to run eval...... and that defeates the purpose.
      I have to know where perl is to run eval...... and that defeates the purpose.
      Yes and no. If you don't know, but the system does, this works. Which leads to:

      1) The sysadmin should know where Perl is on your system.
      2) If you're the sysadmin, then you know where Perl is on your system.

      (1) can fail because the sysadmin doesn't know (or has some other problem I won't go into). (2) can fail for similar reasons -- only the perspective changes.

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