On 5 Dec 2001, at 12:40, Piers Cawley wrote: > "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..& > > 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. > > It depends on how the -p works. And it's (sort of) documented. I realize that, but still it seems odd that the construct: &; actually calls a null-named subroutine rather than giving you a syntax error. For example, if I write this perl program: #!perl &; no -p trickery or the like, I'd have *assumed* that that would get me a syntax error. So I was just musing that it looks like at the very least an un- [semi- ? hidden-?] kind-of-anomaly that Perl doesn't give a syntax error on that. [sort of like when I first learned of the hack in the -w stuff for the string "0 but true", which, AFAIK, is also undocumented] Meta-question: since Perl is content to try to *call* '&main::;' is there some trickery to *DEFINE* such a subroutine? For example, trying: main:: { die; } gets you what I would have expected in the '..&' case: a syntax error for a missing subroutine name. /Bernie\ -- Bernie Cosell Fantasy Farm Fibers mailto:bernie@fantasyfarm.com Pearisburg, VA --> Too many people, too few sheep <--Thread Previous | Thread Next