Link to home
Start Free TrialLog in
Avatar of pvinodp
pvinodp

asked on

using perl's match m/ in a if condition

using the m/ to match multiple options..
my $fallQ = func1();
# $fallQ could be any word, but i want a if condition which succeds only if the $fallQ is either ASM or ac or per. Alsothe match should be case insensitive..

i tried if ($fallQ =~ m/[AC|ASM|PER]/i) {
  #do important stuff;
}
But this did not work
Avatar of Carl Bohman
Carl Bohman
Flag of United States of America image

if ($fallQ =~ m/(AC|ASM|PER)/i) ...
ASKER CERTIFIED SOLUTION
Avatar of Carl Bohman
Carl Bohman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of wilcoxon
wilcoxon
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pvinodp
pvinodp

ASKER

Thanks all