print chg("word", qr/(\d)/); # print "nope" "2" =~ /(2)/; print chg("word", qr/(\d)/); # print "yes" sub chg { $_[0] =~ $_[1]; return $1 ? "yes\n" : "nope\n"; }