Re: matching a [ in a regex

2002-04-02 Thread drieux
On Tuesday, April 2, 2002, at 10:13 , Jenda Krynicky wrote: [..] > Either > > $t = "target\\["; > if($line =~ /$t/){ if '$t' was going to be a qr why not: $t = qr/target\[/; i thought the qr was suppose to simplify the compile and rentime time? that way in 'arbitrary time' when one

Re: matching a [ in a regex

2002-04-02 Thread bob ackerman
On Tuesday, April 2, 2002, at 09:58 AM, Timothy Johnson wrote: > $line = "my target[ target ]"; > > $t = "target["; > if($line =~ /$t/){ > print "yes"; > } try: $t = 'target\['; with single quotes so no interpolation when setting $t.

Re: matching a [ in a regex

2002-04-02 Thread Jenda Krynicky
From: "Timothy Johnson" <[EMAIL PROTECTED]> > When I try to do a pattern match on a variable that contains a '[', I > get the following error: > > Unmatched [ before HERE mark in regex m/target[ << HERE / at > C:\PerlScripts\test.pl line 5. > > Here is my code so far: > > $li

matching a [ in a regex

2002-04-02 Thread Timothy Johnson
When I try to do a pattern match on a variable that contains a '[', I get the following error: Unmatched [ before HERE mark in regex m/target[ << HERE / at C:\PerlScripts\test.pl line 5. Here is my code so far: $line = "my target[ target ]"; $t = "target["; if($line =~ /$t/){ print "y