in reply to Re: Subroutines within if statements
in thread Subroutines within if statements
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/ ) { ... }
|
|---|