The question mark in \s*? is not necessary if you are doing that "in case the words have no whitespace between them." The * quantifier matches zero or more of whatever it is quantifying.
$test = "az";
print "Good\n" if $test =~ /a\s*z/;
The above regex sees an 'a', followed by zero spaces, followed by a 'z'. Since this matches the value of $test, it prints "Good\n".
Cheers! | [reply] [d/l] |