docdurdee has asked for the wisdom of the Perl Monks concerning the following question:
I ended up with something awful:my @subfoos = grep{m/$var/} @foos;
is there a better way?my $regvar = $var; $regsol =~ s/\./___/g; my @subfoos = map {s/___/\./g; $_} grep{m/$regsol/} map{s/\./___/g; $_}@foos; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: matching a variable containing metacharacter treated as character
by choroba (Cardinal) on Feb 21, 2013 at 16:20 UTC | |
by docdurdee (Scribe) on Feb 21, 2013 at 16:47 UTC | |
|
Re: matching a variable containing metacharacter treated as character
by Anonymous Monk on Feb 22, 2013 at 00:30 UTC |