On Mon, 13 Dec 2004 08:49:52 -0800, Graeme St. Clair
<[EMAIL PROTECTED]> wrote:
> 
> 
> 
> From: Harry Putnam <[EMAIL PROTECTED]>
> > I'm working on a program with some 433 lines of perl code.
> > Some where in the course of editing today I've run up on an error that
> > I need some way to debug.
> >
> > the code includes
> >    use diagnostics;
> >
> > And the message I get when I try to run it:
> >
> >   Missing right curly or square bracket at ./nms2.pl line 433, at end
> >   of line syntax error at ./nms2.pl line 433, at EOF Execution of
> >   ./nms2.pl aborted due to compilation errors (#1)
> 
> Clutching at straws...  Is it possible that in the diff's your eye slid past
> a curly bracket that should have been square, but in classic fashion, you
> saw what you expected to see?
> 
> BTDT, GStC.

Turn on use strict for starters, and use warnings.  you won't want to
run with them, if you have things that you know will cause errors, but
they'll give you some other input.  Keep a special eye out for "Bare
word found where $x expected" errors.  The thing to remember is that
perl has no way of knowing what's really missing.  It just knows what
its expects to find based on what it's already seen.  You can change
what it expects with coding errors.  My best guess si that you're
actually missing a semicolon somewhere.  Consider the following:

if (x) {
    eval { 
        print "\n" ; 
    }
}

under some combinations of warning, diagnotics, etc., Perl will carp
about a missing right brace because it never finds the end of the if
block before EOF.  The reason it never finds the end of the if block
is that eval needs a semicolon, but the compiler doesn't know why it
doesn't find the end of the block, it just knows that it doesn't find
the end of that block before EOF.  quotation marks a frequent
offenders, too, as are parenthesis.  But emicolons are probably the
most common.

HTH

--jay

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to