in reply to catastrophic near misses in Perl

On another forum, someone recently posted a problem involving the code:
my $var while (some_condition) { ... }
It refused to run, complaining of a syntax error near ") {".

Everyone focused on the ")" and "{", some speculating that perhaps the issue was the linebreak between them.

The actual problem was, of course, the lack of semicolon after my $var. (my $var while (some_condition); is valid (if pointless) Perl, causing the error when perl saw a while positioned to control statements both before and after it.)

So is that the general type of example you were looking for?

Replies are listed 'Best First'.
Re^2: catastrophic near misses in Perl
by Anonymous Monk on Apr 18, 2009 at 11:42 UTC
    No, thats a syntax error, he wants brainfarts