On Tue, Mar 25, 2014 at 10:48 AM, Ed Avis <eda@waniasset.com> wrote: > Hmm, you are right, C<{} my $x;> is also an error. > Also, C<< { } { } >>. > I think this is a bit fishy; in other C-like languages an empty block can > appear in any > place where a nonempty one can. Could that become true for Perl too? > You seem to forget that { } is also the hash construction operator. { } is far more likely to be an empty hash constructor than an empty block. You can disambiguate by placing a ";" at the start of the block (C<< {; } >>). In the original scenario, you could avoid the problem by commenting the block by adding C<< if (0) >>. Perl could check if the "{ }" is at the start of statement, but any statement can be an expression. Check check for void context since context isn't know yet.Thread Previous | Thread Next