Tanalis has asked for the wisdom of the Perl Monks concerning the following question:
Monks,
I have a set of strings (pulled from a DB) that I'm concatenating into one string, using the following code:
Simple enough, and it does the job, except where the imported strings contain any form of parentheses, for example () or [], where the string always gets appended regardless of whether it's already there or not.if ($concat !~ /$string/) { $concat .= " and $string"; }
I'm trying to find a way to escape the strings that are being matched against - does anyone know of a way to do this? I've tried running the string through qq, and tried using /"$string"/ to match, with no success ..
Thanks in advance for your help.
-- Foxcub
|
---|
Back to
Seekers of Perl Wisdom