in reply to Re: Idiomatic Perl?
in thread Idiomatic Perl?

my $answer = ($str =~ /$pattern/); if ($answer) { print "Yes!"; } else { print "No."; }

I think the ternary here would be even more idiomatic. You can replace those 6 lines with just one:

print $str =~ /$pattern/ ? "Yes!" : "No.";