#!/usr/bin/env perl my $string_to_find = 'hidden'; my @array_to_search = ('Foo', 'whathiddenever', 'Bar', '12hidden456'); my @matches = grep { /$string_to_find/ } @array_to_search; print "@matches";
In reply to Re: Can a regular expression include an arbitrary string variable?
by trippledubs
in thread Can a regular expression include an arbitrary string variable?
by anautismobserver
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |