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

Re: The Santa Claus Golf Apocalypse

Thread Previous | Thread Next
Keith C. Ivey
December 5, 2001 05:19
Re: The Santa Claus Golf Apocalypse
Message ID:
Bernie Cosell <> wrote:

> I realize that, but still it seems odd that the construct:
>     &;
> actually calls a null-named subroutine rather than giving you a
> syntax error.

It's not a null-named subroutine.  The semicolon is the sub 
name.  As you said later in your message, "Perl is content to 
try to *call* '&main::;'" -- note the semicolon.

> 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.

    *; = sub { die };

Keith C. Ivey <>
Washington, DC

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