[wellylug] Perl code trouble

Stephen Judd sljudd at paradise.net.nz
Wed Oct 1 17:16:53 NZST 2003


Quoting Rob Stockley <mowgli at clear.net.nz>:

> Don't you still need the first line to be
> 
> #!/usr/bin/perl
> 
> or something similar?

You only need a shebang on under Unix, where you invoke the file by name from
the command line, thus:

stephen$ myscript.pl

If you pass the name as an argument to perl , you don't need shebang:

stephen$ perl myscript.pl

And Windows uses the extension to figure it out.

c:> myscript.pl

(but no .pl, no luck!).

Shebang lines are a nice bit of hackery to let Unix shells know what interpreter
to use on executable text files, so the above is also valid for python, tcl,
bash, etc.

Stephen



More information about the wellylug mailing list