# eval returns the value of the last evaluated expression if (eval "\$String =~ $RegEx") { print "Matched"; } else { print "Not matched"; }