if ($var1 =~ /$var2/) { print "Matched"; } else { print "Did not match"; }