I'd go with something similar to the above, but remove some stuff:
my $message = ''; if ( $char_keywords > 950 ) { $message = "You had $char_keywords chars. Max is 950"; } if ( failrepeattest() ) { $message .= '<br />' if $message; $message .= 'Repeated keyword error message.'; } if ( $message ) { print qq(<td><font color="red">Keywords: </font></td>); print qq(<td><font color="red">$message</font><br>); } else { print qq(<td>Keywords: </td>); }
You don't need the $error flag. The $message will be empty (false) if there are no errors. I've also taken out the length() check on $message for the same reason .. if the message has length then testing it in this context will return true and the <br> tag will be output.

Cheers!
Rick
If this is a root node: Before responding, please ensure your clue bit is set.
If this is a reply: This is a discussion group, not a helpdesk ... If the discussion happens to answer a question you've asked, that's incidental.

In reply to Re^2: Multiple testing methods by BigLug
in thread Multiple testing methods by sulfericacid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.