Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^2: Array within regexp?

by ambrus (Abbot)
on Feb 27, 2012 at 11:04 UTC ( #956421=note: print w/replies, xml ) Need Help??

in reply to Re: Array within regexp?
in thread Array within regexp?

Correct. However, if you mean the array to contain plain strings you want to match literally, you need to tell that to perl, otherwise it will try to interpret them as regexen, such as interpretting dots in the strings to match any character.

$alt_titles = join '|', map quotemeta, @titles;

Replies are listed 'Best First'.
Re^3: Array within regexp?
by jfrm (Monk) on Feb 27, 2012 at 11:12 UTC

    Thanks for your good answers - I didn't think that would be so easy!

      If you didn't expect it to be easy, why are you using Perl? ;)

      Perl makes simple things easy and hard things possible.
      True laziness is hard work

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://956421]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2022-06-29 07:14 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (96 votes). Check out past polls.