Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

matching a variable containing metacharacter treated as character

by docdurdee (Scribe)
on Feb 21, 2013 at 16:10 UTC ( #1019974=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    my @subfoos = grep{m/$var/} @foos;
  2. or download this
    my $regvar  = $var; $regsol =~ s/\./___/g;
    my @subfoos = map {s/___/\./g; $_} 
                  map{s/\./___/g; $_}@foos;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1019974]
Approved by toolic
Front-paged by MidLifeXis
[ambrus]: choroba: heh heh... I have such a doc bug report somewhere. fixed by now.
[Corion]: Once upon a time I had automatic tests for checking the synopsis, but I stopped doing that because the setup was too fragile on CPAN testers for extracting code from the SYNOPSIS.
[Corion]: Maybe I should move the extraction of the code from the SYNOPSIS section into the author tests, or something like that...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2017-02-27 12:08 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (383 votes). Check out past polls.