develooper Front page | perl.perl5.porters | Postings from February 2016

Re: Colon on first line ignored

Thread Previous | Thread Next
From:
Zefram
Date:
February 2, 2016 01:15
Subject:
Re: Colon on first line ignored
Message ID:
20160202011453.GJ30239@fysh.org
Eric Brine wrote:
>Can anyone explain why a colon on the first line is ignored?

That'll be due to the old convention, predating shebang, for
distinguishing script interpreters.  The arrangement is that a script
starting with a line containing only colon is taken to be a sh script,
and a script starting with a hash is taken to be a csh script.  In sh,
colon is a no-op command; it predates the availability of hash-introduced
comments in Bourne shells.  On a system using this convention, you can
make a Perl script work by starting it with a colon line followed by one
of the well-known duoglot formulations to make sh feed the script to Perl.
For this to work requires that Perl skip the initial colon line.

-zefram

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About