That statement is just asking for a rewrite. Adding or removing new vars is a pain, finding vars is a pain, reading it is a pain, and if the errors are empty you end up with empty lines in the output. Also learn to use qq() and q() instead of "" and '' when you have to include the quote chars inside. Anyway. The following is something like the way an older hand might write this.
$error_html = join "<br />\n", qq(<font size="2" face="verdana" color="#CCCCCC">) . qq(<b>Please fix the following errors:</font>) . qq(<font size="1" face="verdana" color="#003471">), (grep { defined $_ } $error_msg_x, $error_msg_xx, $error_msg_xxx, $error_msg_pw_xxx, $error_msg_pw_x, $error_msg_pw_xx, $error_msg_terms, $error_msg_email, $error_msg_city, $error_msg_state, $error_msg_date, $error_msg_zip ), "</b></font>\n" ;
I have concerns that these error variables are inappropriate. Maybe you should have an @errors array and when you encounter an error do something like:
And then you could replace the list of vars there with @errors and lose the grep (actually everything inside that (grep ...) expression)push @errors,"<b>Password:</b> You must enter a value";
Also there is a possible issue that if your error message contains html or html characters that it should actually be escaped before printing. This may not be an issue for you, but its worth keeping in mind.
hth
First they ignore you, then they laugh at you, then they fight you, then you win.
-- Gandhi
In reply to Re: Warnings, strict HTML scalar
by demerphq
in thread Warnings, strict HTML scalar
by perleager
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |