Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Remove text within parenthesis

by choroba (Chancellor)
on May 07, 2013 at 22:11 UTC ( #1032536=note: print w/replies, xml ) Need Help??


in reply to Remove text within parenthesis

To avoid the interpretation of parentheses inside $1, use \Q:
$s =~ s/\Q$1//;

Note that this is still not the desired "bla bla somestring" because there are two spaces after the bla bla.

لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Remove text within parenthesis
by firmament (Novice) on May 08, 2013 at 07:32 UTC
    Thanks a lot for the \Q advice, very interesting.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032536]
help
Chatterbox?
[Tanktalus]: What's so happy about it? :P
[Tanktalus]: ww: your parens don't line up. Sure, perl can look like line noise, but the parens still have to line up. ;)
[Tux]: 1nickt did you build 5.24.3, 5.26.1, and 5.27.4 yet?
Tux now has 284 working versions of perl
[1nickt]: Tux oh yes, have filed reports from them already :-)
1nickt has 44 for one version of one OS ...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2017-09-25 16:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (282 votes). Check out past polls.

    Notices?