develooper Front page | perl.fwp | Postings from December 2001

Re: The Santa Claus Golf Apocalypse

Thread Previous | Thread Next
From:
Piers Cawley
Date:
December 5, 2001 04:54
Subject:
Re: The Santa Claus Golf Apocalypse
Message ID:
m21yi9suue.fsf@bofh.org.uk
"Bernie Cosell" <bernie@fantasyfarm.com> writes:

> On 5 Dec 2001, at 18:04, Andrew.Savige@ir.com wrote:
>
>> Piers Cawley wrote:
>> > I think the particular 'creative in the extreme' entry that Andrew was
>> > referring to was my head.pl that printed 10 lines then crashed using:
>> >
>> >     #!perl -p
>> >     11..&
>> 
>> Yes indeed. When I first saw that I fell off my chair laughing.
>> When I was finally able to pick myself up off the floor, I stared
>> at the error message it produced for a while, then realised I had
>> no idea what it did, how it worked, or even if it was valid Perl or
>> Swahili or whatever, ...
>
> Me, too. Is that actually exploiting a bug in perl? [which is legit,
> of course -- I just seeking some clarification/understanding here].
> It seems that "&<ENDOFFILE>" is interpreted as a subroutine call to
> a subtroutine with no name. I'd have thought that that would get you
> a syntax error (as you do get in almost every other case I tried
> that tried to call an null-named subroutine. Or am I
> misunderstanding [likely] how that works??

It depends on how the -p works. And it's (sort of) documented.

-- 
Piers

   "It is a truth universally acknowledged that a language in
    possession of a rich syntax must be in need of a rewrite."
         -- Jane Austen?

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