in reply to Re: how can I use regular expresion if my string to be matched has round brackets
in thread how can I use regular expresion if my string to be matched has round brackets

why it works with
my $ipn=qr/\( going \) there/; or my $ipn=qw/\( going \) there/;
but it doesn't work with
my $ipn="\( going \) there";
Thanks.

Replies are listed 'Best First'.
Re^3: how can I use regular expresion if my string to be matched has round brackets
by GrandFather (Saint) on Oct 06, 2008 at 23:00 UTC

    You need:

    my $ipn="\\( going \\) there";

    The \\ gets replaced by \ when the string is parsed.


    Perl reduces RSI - it saves typing