[Pdx-pm] Escaping a character in a string from a file

Randal L. Schwartz merlyn at stonehenge.com
Wed May 12 15:20:55 CDT 2004

>>>>> "John" == John  <jgoalby at hotmail.com> writes:

John> I have a file of regular expressions I want to match.  I read in the file
John> and then match each entry as such:

John> if ($something =~ /$tomatch/i)

John> I want to be able to specify something like ".pl" in the file so that I can
John> match all perl files.  Specifying .pl matches .apl.  Is there a way I can
John> escape the "." when it is in a file?  I tried "\.pl", but it didn't work.

Uh, that should have, with the code you have above.  Can you show
an example of it not working?

Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

More information about the Pdx-pm-list mailing list