I have my code like this:
if ( $var eq \"str1\" || $var eq \"str2\" || $var eq \"str3\" ) { ... }
Is there anyways to optimize this. I want
In Perl 5.10 or better:
if ($var ~~ [qw( str1 str2 str3 )]) { ...}
The ~~ operator does a smart match between its arguments.
~~