Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Answer: How do I escape meta-characters in a user-defined string?

by btrott (Parson)
on Mar 25, 2000 at 01:05 UTC ( #6103=categorized answer: print w/replies, xml ) Need Help??

Q&A > regular expressions > How do I escape meta-characters in a user-defined string? - Answer contributed by btrott

if($string=~/\Q$key\E/){
Quotes the metacharacters.

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[1nickt]: choroba Updated the PR, using Config instead of exposing the hackery. Using cpanfile-dump does not work to test, as shown in the earlier PR comment, even when using a binary built for a particular Perlbrew perl, the output seems to be
[1nickt]: ... from the system perl binary. Using cpanm --installdeps . does use the expected perl and tus the check acts correctly.

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (15)
As of 2017-10-18 16:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (249 votes). Check out past polls.

    Notices?