I think this is very good info .. I have tried on Windows and Unix as well . 
- I found like , this line does not matter on windows . Windows need .pl 
extension but Unix/Linux does not . 

- Unix required this interpreter line when we are executing as , e.g ./test.pl 
or ./test.

If the line is not given then inside script running on Unix , then need to 
execute it using perl interpreter externally .


Thank you All .

-Sunita

-----Original Message-----
From: alanhag...@gmail.com [mailto:alanhag...@gmail.com] On Behalf Of Alan 
Haggai Alavi
Sent: Tuesday, January 04, 2011 11:16 AM
To: Sunita Rani Pradhan
Cc: beginners@perl.org
Subject: Re: 1st line of perl script

Hi Sunita,

>            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 .

It is a shebang line which is only useful in Unix-like operating
systems. In such systems, the shebang line should start in the first
column of the first line. When such a script with its executable bit
set is run by itself, the operating systems checks for the shebang
line to see which interpreter should be used for executing the script.

However, in Windows (and other non-Unix-like operating systems), the
shebang is usually considered a comment and skipped. Instead of the
shebang line, such systems depend on file extension associations or
explicit invocation of the script using the interpreter.

For more details, see: http://en.wikipedia.org/wiki/Shebang_(Unix)

Regards,
Alan Haggai Alavi.
-- 
The difference makes the difference

--
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