On Thu, Sep 22, 2005 at 10:54:29AM -0500, Andy Lester wrote: > On Thu, Sep 22, 2005 at 11:50:07AM -0400, Joel Gwynn ([EMAIL PROTECTED]) > wrote: > > This leads me to consider the many other characters that would need > > escaping. What's the right way to do this without escaping every > > non-alpha character? > > First, you don't have to escape every non-alpha character. Just the > ones that have meta-meaning. > > Second, you want the \Q sequence, as in /\Qlong(parenthesized)string./
One really nice thing about perl is that you *can* escape every non-alpha to protect against magic. That was a real problem in pre-perl days when the option was to write code that generated sed or awk programs from arbitrary text - you had to protect the non-alphas in the base set, but avoid protecting those in the extended set (which only had their meta-meaing when they *were* preceeded by a backslash). Having \Q as a way of letting perl do the protection for you is nice extension too. That cleaned out a lot of "s/\W/\\\1/g" code when it got added (sometime in perl3, I think). -- _______________________________________________ Boston-pm mailing list [email protected] http://mail.pm.org/mailman/listinfo/boston-pm

