develooper Front page | perl.perl5.porters | Postings from July 2009

Re: "Keyword" labels now forbidden (was [perl.git] branch blead, updated. GitLive-blead-1705-gf71d615)

Thread Previous
From:
Rafael Garcia-Suarez
Date:
July 30, 2009 00:44
Subject:
Re: "Keyword" labels now forbidden (was [perl.git] branch blead, updated. GitLive-blead-1705-gf71d615)
Message ID:
b77c1dce0907300044s4a897f5ar58606d66b941e303@mail.gmail.com
2009/7/30 David Nicol <davidnicol@gmail.com>:
> On Thu, Jul 30, 2009 at 1:19 AM, Rafael
> Garcia-Suarez<rgarciasuarez@gmail.com> wrote:
>> 2009/7/30 David Nicol <davidnicol@gmail.com>:
>
>>> it's already a synbtax error when it makes no sense.  What's the harm?
>>
>> No it's not :
>>
>> $ perl -e 'goto print'
>> Can't find label 1 at -e line 1.
>
> $ perl -le '1: $x++ > 3 and die 1; goto print $x'
> syntax error at -e line 1, near "1:"
> Execution of -e aborted due to compilation errors.
>
> is there a way to create "1" as a label? perldoc perlsyn says labels
> "consist of an identifer followed by a colon" but the word
> "identifier" does not appear again in that document.
>
> Allowing numeric labels would make Perl more friendly to FORTRAN programmers...

Or BASIC.

At best I could write a source filter for that. Colon-less numeric
labels at the beginning of lines. And allow uppercase GOTO.

10 say "this is perl, sort of\n";
20 GOTO 10;

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About