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

Re: The Santa Claus Golf Apocalypse

Thread Previous | Thread Next
From:
Keith C. Ivey
Date:
December 5, 2001 05:19
Subject:
Re: The Santa Claus Golf Apocalypse
Message ID:
3C0DD8A4.3113.20B462EE@localhost
Bernie Cosell <bernie@fantasyfarm.com> 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 <kcivey@cpcug.org>
Washington, DC

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