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

I am getting a syntax error on the last line of the snippet below, does anyone see why? I've tried adding more ) and ,s but that didn't seem to work.

Thanks in advance,

print start_form( -method => 'post', -enctype => 'multipart/form-data', -action=> '' ), table({-border=>1, -width=>600, -bgcolor=>'\#eeeeee', cellpadding=>0 +, cellspacing=>0}, Tr( td("File: "), td( textfield( -name => 'title1', -size => 50, -maxlength => 80 ), td("Short Description: "), td( textfield( -name => 'desc1', -size => 50, -maxlength => 80 ), ), td( filefield( -name => 'upload1', -size => 50, -maxlength => 80 ), ), ), Tr( td("File: "), td( textfield( -name => 'title2', -size => 50, -maxlength => 80 ), td("Short Description: "), td( textfield( -name => 'desc2', -size => 50, -maxlength => 80 ), ), td( filefield( -name => 'upload2', -size => 50, -maxlength => 80 ), ), ), Tr( td("File: "), td( textfield( -name => 'title3', -size => 50, -maxlength => 80 ), td("Short Description: "), td( textfield( -name => 'desc3', -size => 50, -maxlength => 80 ), ), td( filefield( -name => 'upload3', -size => 50, -maxlength => 80 ), ), ), Tr( td("File: "), td( textfield( -name => 'title4', -size => 50, -maxlength => 80 ), td("Short Description: "), td( textfield( -name => 'desc4', -size => 50, -maxlength => 80 ), ), td( filefield( -name => 'upload4', -size => 50, -maxlength => 80 ), ), ), Tr( td(), td( submit( 'button', 'submit' ), ) ) ), end_form(), hr;

janitored by ybiC: Balanced <readmore> tags around long codeblock, as per Monastery convention

Replies are listed 'Best First'.
Re: Basic syntax problem
by dragonchild (Archbishop) on Sep 05, 2003 at 13:48 UTC
    Most non-Windows editors have a facility for checking brace-balance. In vi, it's %. Use it.

    Another suggestion would be that you never type {, (, or [ without immediately typing the matching }, ), or ]. I do this and almost never have brace-balancing issues.

    ------
    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

      Funnily enough, most window editors also have that facility...it ^M in mine. I realise that Notepad doesn't, but then neither does ed. They are of about equivalent functionality and use.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
      If I understand your problem, I can solve it! Of course, the same can be said for you.

Re: Basic syntax problem
by Taulmarill (Deacon) on Sep 05, 2003 at 13:34 UTC
    you have 43 "(" but only 40 ")" in your code snipet.
    look for yourself where the 3 ")" are missing.
Re: Basic syntax problem
by allolex (Curate) on Sep 05, 2003 at 17:13 UTC

    Look down your list of td elements. Do you see the one that aren't aligned? (Using alignment to your advantage helps a lot.) They don't have matching right parentheses. You should probably take dragonchild's advice and always type your two brackets together. That and a good editor can help a lot. Lastly, use perltidy. It can also tell you where to look for this kind of error.

    Tr( td("File: "), td( ###HERE textfield( -name => 'title4', -size => 50, -maxlength => 80 ), td("Short Description: "),

    HTH

    --
    Allolex