On 1/4/11 12:33 AM, Sunita Rani Pradhan wrote:
             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 .

On Unix, it allows you to run your script with just the scripts filename rather than running the interpreter and passing the filename as an argument. "./myscript" instead of "perl myscript".

On Windows, that line is just a comment. Neither the operating system nor the interpreter does anything with it. To run a script with just the name, you need to use a file extension associated with the Perl interpreter. The standard extension is ".pl", though in principle you could use something else. If you don't have corporate overlords forcing you to use something else, just use ".pl".

I would, however, recommend that you use the "#!/usr/bin/perl" line even on Windows. It will make things a little easier if you have to move the script over to a Unix like system. It won't cause any problems in windows, it will just get skipped right over.

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