if (condition) { $str =~ /ab/; } else { $str =~ /ef/; } $str2 =~ //;