develooper Front page | perl.perl5.porters | Postings from March 2014

Re: [perl #121501] Empty code block {} causes syntax error(misparsed as anonymous hash constructor?) before 'sub'

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
March 25, 2014 14:44
Subject:
Re: [perl #121501] Empty code block {} causes syntax error(misparsed as anonymous hash constructor?) before 'sub'
Message ID:
20140325144225.GS1615@iabyn.com
On Tue, Mar 25, 2014 at 04:23:54AM -0700, Ed Avis wrote:
> Please allow an empty BLOCK to occur before a subroutine
> definition, just as an empty BLOCK can occur elsewhere in a program.

Can you give an example of such an empty block not being a syntax
error?

All these are syntax errors:

    {
    }
    my $x;


    {
    }
    $x = 1;


    {
    }
    foo();


-- 
Diplomacy is telling someone to go to hell in such a way that they'll
look forward to the trip

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