[Melbourne-pm] The magic of shebang (was Re: programming tutorials: Perl)
Alec Clews
alecclews at gmail.com
Sun Nov 14 22:09:33 PST 2010
On Mon, 2010-11-15 at 16:48 +1100, john thornton wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Thanks very much for that. I went to the site and downloaded the perl
> training book. Perldocs...so many.
>
> The only part that confuses me is that if
>
> # is a comment
>
> then why does the shebang line have any influence:
>
> #!/usr/bin/perl
>
> or as a variant to show warnings for code
>
> #!/usr/bin/perl -w
>
> I am using to using # to "comment out" configuration files in Linux
> for setting up mysql and so on.
the shebang notation (#!) is specific to UNIX (and hence Linux)
The #! is actually interpreted by the kernel and tells it which
interpreter to use (in this case Perl)
Perl ignores the line[1]
See also http://en.wikipedia.org/wiki/Shebang_(Unix)
[1] That was a lie. As a special case Perl will look at the line and use
any flags it sees. e.g.
#!/bin/env perl -p
will switch on the pseudo sed mode
--
Alec Clews
Personal <alec.clews at gmail.com> Melbourne, Australia.
Jabber: alecclews at jabber.org.au PGPKey ID: 0x9BBBFC7C
Blog http://alecthegeek.wordpress.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20101115/bbb6566a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20101115/bbb6566a/attachment.bin>
More information about the Melbourne-pm
mailing list