>From 'perldoc perlop':
"The following escape sequences are available in constructs that
interpolate but not in transliterations.
\l lowercase next char
\u uppercase next char
\L lowercase till \E
\U uppercase till \E
\E end case modification
\Q quote non-word characters till \E"
So something like this will work:
#########################
use strict;
use warnings;
my $one = 'this (is a) 1/2 measure example';
my $two = 'aaaathis (is a) 1/2 measure exampleaaa';
if($two =~ /\Q$one/){
print "YES!\n";
}
##########################
-----Original Message-----
From: Tom Allison [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 07, 2006 10:59 AM
To: [email protected]
Subject: regex grrr
Here's my problem:
$one = 'this (is a) 1/2 measure example';
Try and run that through a regex like
if ( $two =~ /$one/ ) {
and it's pretty ugly.
Who do I get the literal string for $one?
<snip>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>