Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Finding unmatched brackets/braces

by ezekiel (Pilgrim)
on Feb 14, 2002 at 01:39 UTC ( [id://145332]=perlquestion: print w/replies, xml ) Need Help??

ezekiel has asked for the wisdom of the Perl Monks concerning the following question:

Is there a convenient means of finding unmatced brackets or braces in a script or module? I am looking at someone else's code. It doesn't compile due to a "Missing right curly or square bracket". I have been through the code numerous times but everything seems to match up. Is there are tool or utility that will parse a file and show you if/where mismatched brackets occur? Thanks.

Replies are listed 'Best First'.
Re: Finding unmatched brackets/braces
by Anonymous Monk on Feb 14, 2002 at 02:00 UTC
    You might try cperl-mode in emacs, or perltidy.

    --
    perl -pe "s/\b;([st])/'\1/mg"

      See, that's from getting redirected to www.perlmonks.org randomly. I posted (my sig is there afterall), but it went through www.perlmonks.org and hence shows an Anoynmous Monk.

      UPDATE: Would someone please enlighten me as to why this simple bug report (and the prior one) warrant a --? I don't care about the XP, but honestly, how does it warrant a--? The former node was in a thread *explicitly* about PM bugs since the move.

      --
      perl -pe "s/\b;([st])/'\1/mg"

Re: Finding unmatched brackets/braces
by Speedy (Monk) on Feb 14, 2002 at 01:49 UTC
    One of the joys of switching to Linux and using VI (and its enhancements vim and gvim) was learning that while one is in Command mode highlighting a paren, bracket, or brace and entering shift-% (both together) leads the cursor to hop to the matching paren, bracket, etc.

    Really helps track down some gremlins!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://145332]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-18 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found