Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Execute a file

>The top line of the file is:
>#!/usr/bin/perl -P
>I found that if I type:
>/usr/bin/perl -P index.pl
>It works perfectly.
>Does anyone have any suggestions as to what I'm doing wrong? It works 
>fine on another system I have, simply copied the file across.

man perlrun says that -P causes the script to be run through the C
preprocessor before being executed by perl. So I created a small file

bash$ cat /tmp/date.pl
#!/usr/bin/perl -P
print __DATE__, "\n";

and got this when I tried to preprocess it:

bash$ gcc -E - < /tmp/date.pl
:1: invalid preprocessing directive name
# 1 ""
#!/usr/bin/perl -P
print "Sep 27 2000", "\n";

So maybe the preprocessor error is upsetting perl?

Why not preprocess the file before installing?