I just
noticed, after I sent my first e-mail, not only did you fail to provide
parentheses to setup your pattern memory, you are actually putting in a
preceding '\' instead of '/' in your substitution.
The
substitution string (if you're really just trying to prepend '/') should be
s/...//\/$1/g;
I
assume you probably are trying to use '\' so s/...//\\$1/g; should work (you
shouldn't need the braces around the $1).
Chad
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Friday, August 26, 2005 7:53 AM
To: [email protected]
Subject: Metacharacters
Morning,
I am working on some code which will check for a line starting with any Perl Metacharacters, and precede it with a '/'.
Here is what i have thus far:
if ($LogLinePrefix =~ /[\^\$\+\*\?\.\|\(\)\{\}\\\[\]]/)
{
$LoglinePrefix =~ s/[\^\$\+\*\?\.\|\(\)\{\}\\\[\]]*/\\{$1}/g ;
}
Unfortunately, this isn't working. Can anyone make a suggestion?
Regards/Thanks
Chris McEwen
Sr. Configuration Management Analyst
Alcatel Canada Inc.
Office: 416.748.4424 ext 5015
mailto: [EMAIL PROTECTED]
_______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
