Tony Esposito wrote:
> So if I understand you correctly, if the line
> 
>               #!/usr/bin/perl
> 
> exists in your Perl program, then that Perl is used regardless.

No. That program is only used if your script is started by the kernel. This
is called an "interpreter file" and the behavior is documented in the
execve(2) manpage.

If *you* start a perl executable and pass your script to it, the program on
this line is ignored, and the perl you started executes the script.

> 
> And if it is missing, then
> 
>       perl -e myperl

You *still* wouldn't use -e here.

> 
> will use the first Perl environment that is found in the environment
> $PATH. 

The first perl found on the path will be started and will execute your
script. The program specified on the #! line (if any) is ignored.

To summarize:

   ./foo.pl           <-- runs the script using the perl named in the #!
line.
                          script must be chmod +x.

   perl foo.pl        <-- runs the script using first perl in the PATH. any
                          program named on the #! line is ignored. script
need
                          not be chmod +x.

   /bin/perl foo.pl   <-- runs the script using /bin/perl. PATH is ignored,
and
                          any program named on the #! line is ignored.
script
                          need not be chmod +x.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to