if ($str =~ /xxx/) {
print "含んでいる\n";
}

の/xxx/の部分て文字列じゃなく、変数にしてもできるんですか?

if ($str =~ /$str2/) {
print "含んでいる\n";
}

みたいに