M
Marcus Brody
Hi,
I'm new to perl and programming, so please please dont throw the
manual at me!!
Im trying to do a pattern match e.g.
if $foo =~ m/$bar/
However, on occasions $bar contains something like "HMGI(Y)", and the
brackets are intefering with the pattern match. In all other
instances my script works. I presume the brackets are being
extrapolated such that my pattern match *essentially* becomes:
if "HMGI(Y)" =~ m/HMGI(Y)/
Which clearly wont work, as the brackets are only used to capture Y in
the variable $1, and are otherwise "ignored". Is there a way to
"escape" things in variables, even though I dont know whether they are
going to contain a bracket or not??
Thanks in advance
MB
I'm new to perl and programming, so please please dont throw the
manual at me!!
Im trying to do a pattern match e.g.
if $foo =~ m/$bar/
However, on occasions $bar contains something like "HMGI(Y)", and the
brackets are intefering with the pattern match. In all other
instances my script works. I presume the brackets are being
extrapolated such that my pattern match *essentially* becomes:
if "HMGI(Y)" =~ m/HMGI(Y)/
Which clearly wont work, as the brackets are only used to capture Y in
the variable $1, and are otherwise "ignored". Is there a way to
"escape" things in variables, even though I dont know whether they are
going to contain a bracket or not??
Thanks in advance
MB