Update: you can even precompile the regex for multiple uses:if ( "add" =~ /^\Q$answer/ ) { ... }
my $ans = qr/^\Q$answer/; if ( "add" =~ /$ans/ ) { ... } elsif ( "remove" =~ /$ans/ ) { ... }
In reply to Re^2: Subroutines within if statements
by runrig
in thread Subroutines within if statements
by muizelaar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |