suaveant has asked for the wisdom of the Perl Monks concerning the following question:

Ok, so I am rewriting PSC to use shebang (#!) loading instead of the ugly stupid mess I can up with in the first place (running scripts in a safe path based on the name of a dynamic link... pleah) but I have run across the following problem. When I put #!/usr/bin/psc at the top of my script, perl does it's special thing and and runs the script under /usr/bin/psc even when called perl test.pl. Now this creates a problem since psc opens, does its thing, and then tries to feed the script to perl

I realize this is supposed to happen, and I also realize this can be fixed by having the word perl in the shebang line. But is there another way... like a command line option or something?

                - Ant
                - Some of my best work - Fish Dinner

Replies are listed 'Best First'.
Re: Shebangs... (ignoring)
by Zaxo (Archbishop) on Sep 23, 2001 at 11:56 UTC

    You are nearly there with your remark about the word perl in the shebang line. If you add a comment of the form #!perl as the second line of test.pl, the -x switch will make perl act as you want. Example:

    $ cat test.pl #!/bin/sh #!perl print "$ENV{PWD}\n"; $ perl test.pl test.pl: print: command not found $ perl -x test.pl /home/Zaxo $

    After Compline,
    Zaxo