Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Array within regexp?

by ambrus (Abbot)
on Feb 27, 2012 at 11:04 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-25 09:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found