in reply to Untainting name data from form

You could use the \x to make your code more readable.
use strict; my $x='Mr. Popcorn Dave'; print "Name valid\n" if m/^\s* #ZERO OR MORE SPACES (M(s|rs?|iss)\.?\s+)? #POSS SALUTATION [A-Z]+\.?\s+ #NAME AFTER SAL. [A-Z]+ #2nd NAME \s*([A-Z]+\s*)?$/ix; #SUFFIX
I have changed a couple of things,but I mainly I think it is clearer if you have \s* instead of (\s+)? and use the \x so that when you look back at this latter you have an idea of what each part of this regex does.