Parham has asked for the wisdom of the Perl Monks concerning the following question:
if i replace $b with e (with no metacharacters), the program snippet works fine. maybe i'm approaching this the wrong way. Does anyone have a better solution, something simple, yet flexible?$input = '$b'; @var = ('a','$b','$c','d','e','$f','g'); unless (grep /^$input$/, @var or $var eq "") { print "error"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: checking input using grep()
by chip (Curate) on Dec 28, 2001 at 05:04 UTC | |
by Aristotle (Chancellor) on Dec 28, 2001 at 09:28 UTC | |
by chip (Curate) on Dec 29, 2001 at 00:14 UTC | |
by Aristotle (Chancellor) on Dec 29, 2001 at 00:39 UTC |