shapi003 has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: build regular expression from scalar?
by dragonchild (Archbishop) on Nov 26, 2003 at 19:44 UTC | |
|
Re: build regular expression from scalar?
by jeffa (Bishop) on Nov 26, 2003 at 22:21 UTC | |
|
Re: build regular expression from scalar?
by Roger (Parson) on Nov 26, 2003 at 22:41 UTC | |
|
Re: build regular expression from scalar?
by holo (Monk) on Nov 26, 2003 at 21:27 UTC | |
|
Re: build regular expression from scalar?
by davido (Cardinal) on Nov 27, 2003 at 05:01 UTC | |
|
Re: build regular expression from scalar?
by Anonymous Monk on Nov 26, 2003 at 23:23 UTC |