At 15:09 +1100 26/11/02, Ken Williams wrote:
On Tuesday, November 26, 2002, at 12:49 PM, Peter N Lewis wrote:
Ahh, yes, good point.But is there any reason the # comments are not terminated by the first occurrence of *either* \012 or \015?There's nothing perl can do about this - the OS (in fact, the kernel, I think) reads that shebang line in order to know it should call perl. By the time perl gets to look at it, it's too late.
Except - the shell reads the file and executes the program that is the first word after the #! so perl will indeed get called for a file with the wrong line endings, although it might get called with the entire file inserted into the ARGV. But then perl does all sorts of wacky emulation at that point anyway, so don't ask me what goes on there, I couldn't figure it out.
For example, a file containing
#!/bin/ps auxw
when executed does the ps with those flags.
A file containing
#!/bin/echo -e 'foreach (@ARGV) { print "$_\n"; }'
blah blah blah
displays 'foreach (@ARGV) { print "$_\n"; }'
But a file containing
#!/usr/bin/perl -e 'foreach (@ARGV) { print "$_\n"; }'
foreach (@ARGV) { print "$_\n"; }
displays nothing, presumably because of perl doing some wacky emulation on the command line.
Enjoy,
Peter.
--
<http://www.interarchy.com/> <http://download.interarchy.com/>