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

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

Thread Previous
From:
drieux
Date:
April 29, 2002 08:56
Subject:
fun with sheBang was Re: I can't get this to run!
Message ID:
8D7CE9FC-5B89-11D6-88C8-0030654D3CAE@wetware.com

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/junk.pl
/tmp/drieux/junk.pl: command not found: use [2]
hello World

[jeeves:~] drieux% cat /tmp/drieux/junk.pl
#!/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....

ciao
drieux

---


Thread Previous


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