$string = 'My Test Data'; $regex = 'm/\bTest\b/i'; $stmt = 'if ($string =~ $regex){print "It Works!\n"}else{print "No joy!\n"}'; eval $stmt;