use MyRegEx; if($string =~ MyRegEx::compile('a','n')){ print "matched\n"; }