anautismobserver has asked for the wisdom of the Perl Monks concerning the following question:
I want to search an array for an arbitrary sting variable. All the examples I've found use regular expressions. Is there a way to devise a regular expression that includes an arbitrary string variable (unknown in advance)?
For example:
my #string_to_find = 'hidden'; my @array_to_search = ('Foo', 'whathiddenever', 'Bar', '12hidden456');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can a regular expression include an arbitrary string variable?
by davido (Cardinal) on Oct 17, 2019 at 05:01 UTC | |
|
Re: Can a regular expression include an arbitrary string variable?
by AnomalousMonk (Archbishop) on Oct 17, 2019 at 02:47 UTC | |
|
Re: Can a regular expression include an arbitrary string variable?
by trippledubs (Deacon) on Oct 17, 2019 at 02:49 UTC | |
|
Re: Can a regular expression include an arbitrary string variable?
by jcb (Parson) on Oct 17, 2019 at 04:22 UTC | |
|
Re: Can a regular expression include an arbitrary string variable?
by Anonymous Monk on Oct 17, 2019 at 07:36 UTC |