develooper Front page | perl.beginners | Postings from April 2002

fun with sheBang was Re: I can't get this to run!

Thread Previous
April 29, 2002 08:56
fun with sheBang was Re: I can't get this to run!
Message ID:

On Sunday, April 28, 2002, at 05:57 , Peter Scott wrote:

> At 05:20 PM 4/27/2002 -0700, drieux wrote:
>>> That's because the shebang line is ignored when you prefix the script 
>>> with
>>> the perl command.
>> you are correct - but I prefer to assert it the other way around,
>> when the perl interpretor is invoked with a file - it reads and
>> executes the perl way - hence #<foo> is parsed as comment and is
>> irrelevant.
> Beep, no.  Observe:
> $ perl
> #!/foo/bar/perl -T
> Too late for "-T" option at - line 1.
> The line is *not* ignored.  The path is ignored, but the options are 
> still read out and set.  Another demonstration of this:
> $ perl
> #!/foo/bar/perl -w
> print
> Use of uninitialized value in print at - line 2.
> ^D
> $ perl
> print
> ^D
> $

My complements on this - since the other case is even sillier:

[jeeves:~] drieux% sh /tmp/drieux/
/tmp/drieux/ command not found: use [2]
hello World

[jeeves:~] drieux% cat /tmp/drieux/
#!/foo/bar/perl -T
use strict;

print "hello World\n";
[jeeves:~] drieux%

Obviously I need to grow out my collection of 'Perl Sillies'
where I keep track of the underlying bits and bobs of what
is actually being parsed and dealt with....



Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About