Ok, I see. I was about to revert to my original solution so users wouldn't have to remember exceptions in character classes with characters ^ ] and -. \Q\E removes those exceptions. I think its the first time I used \Q\E. Thanks Roland! > On Fri, Aug 27, 1999 at 02:33:30PM -0500, Edward M. Perry wrote: > > Ok, I'm really not that dull. Really. I was writing a funtion that takes > > two strings and replaces all occurances of characters in $a that occur in > > string $b. I over-generalized the problem to include all meta characters > > (I only want a subset). Having defined a built-in function, I am now deluged > > with RTFM. > > > > %meta = map {($_,1)} split('', $b); > > $a = join('', map {if ($meta{$_}) {"\\$_"} else {$_}} split('', $a)); > > > > Ok, I was being stupid. Really. I forgot that a character set removes the > > meta-ness from its characters. What I wanted was simply this: > > > > $a =~ s{[$b]}{_}g; > > > > Let the mockery begin. > > > > Hmm, you still need the \Q and \E. > > $b = 'x]**[y'; > > Ronald ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe