Perl would respond to this error with something like:
Missing right curly or square bracket at foo.pl line 5, at end of line
syntax error at foo.pl line 5, at EOF
Obviously, Perl (or PHP) can't really tell there's a '}' missing until the very end of the file is reached...