Bernie Cosell schreef op 05 december 2001: > On 5 Dec 2001, at 14:09, Eugene van der Pijll wrote: > > > Bernie Cosell schreef op 05 december 2001: > > > 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. > > > > perl -e'*;=sub {1}; print &;' > > good heavens.. the actual subroutine name is semi-colon?? So the name isn't > missing and isn't null, but is ';'. I'm not sure that that doesn't make it > MORE confusing to me --- Are there other punctuation marks that work in that > context?? > > Three questions: > 1) is semicolon the ONLY puncuation mark that has this odd > special-dispensation? I'd expect not. > 2) WHY does perl allow this --- it still seems like a slam-dunk syntax error > situation to me The global variables @a, $a, %a and &a are all stored in the same data structure (the typeglob, see perldata). Therefore, if the subscript separator variable $; can be used, there should be an entry in the symbol table for ;, and @;, %; and &; are valid names. > 3) who *discovered* this anomaly? [how does someone even think to TRY > something bizarre like this.....] In my case, I discovered it quite accidentally. I replaced exit with &f, resulting in an 'undefined subroutine f called' error. Then Piers said it could be one character shorter... EugeneThread Previous | Thread Next