You can put any path in that line, not only /usr/bin/perl.

If you are using Perl under Windows, you may want to put paths like:

#!C:/perl/bin/perl
#!C:/perl/bin/perl.exe

If a Perl program uses this line under Unix/Linux and if the program is executable, it can be ran by just using:

./program_name

without needing to use
perl program_name

Under Windows it doesn't help that line at all if you just need to run the programs from a command line.

But it can help you if you need to run Perl programs as CGI scripts with Apache.

I have Apache installed on E: drive and Perl on the same drive in the folder e:\usr
and in this case I can use

#!/usr/bin/perl

as the first line in CGI scripts
(although I haven't used CGI scripts for years:)

--Octavian

----- Original Message ----- From: "Sunita Rani Pradhan" <sunita.prad...@altair.com>
To: <beginners@perl.org>
Sent: Tuesday, January 04, 2011 7:33 AM
Subject: 1st line of perl script


Hi All



           Perl script  works without the first line ( perl Interpreter
: #! /usr/bin/perl) . What is the real use of this line ? This line does
not through any error on Windows where , this path does not exist .

Why is it so ?



Could anybody explain it  clearly?



Thanks

Sunita



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to