in reply to disregard spaces while matching ?
$words_to_match = qr/\s*Hello\s+World\s*/; # use \s* or \s+ as needed @trials = ("Hello World", " Hello World ", "Hello,World"); for ( @trials ) { $result = ( /$words_to_match/ ) ? "matches" : "does not match"; print "$_ $result\n"; }
|
|---|