Is there a way to do something like:
I want to define what actions will be monitored from what a user inputs using GetOpt::Long. So sometimes they might set $monitoredActions = "ADD", and another time they might enter more than one thing to monitor (e.g., "ADD|DELETE"). What is best way to handle this without writing a bunch of if..then.else?$monitoredActions = "ADD|REMOVE|DELETE"; if ($action =~ /$monitoredActions/) { // do something }
David
Edit by tye, preserve formatting
In reply to build regular expression from scalar? by shapi003
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |