I've had similar issues and the \Q \E flags didn't fix it.

One thing I've done to fix an issue where regex metacharacters are being
caught is to do a replace on all of the characters to include a \ right in
front.

Something like this:

open (my $FILE, "<", $file) or die "$!\n";
my @lines = <$FILE>;
for (@lines)
{
      s|(["'\+\$\(\)])|\$1|g;
}

*go back to regular coding.*

The ( ) sets this block to the $1 variable (From your examples you are
already familiar with this).
The [ ] gives a list of characters that might be caught in the flag.
The \ in the set are just there as escape characters.

It is an ugly brute force method, but it has worked for me before.

On Sat, Nov 13, 2010 at 2:08 PM, Shawn H Corey <shawnhco...@gmail.com>wrote:

> On 10-11-13 01:42 PM, Zachary Brooks wrote:
>
>> 1. My first approach was to use substitute to get rid of a range of things
>> between<DOC>  and</DATELINE>. A short version looks like this.
>>
>> $hello = "<DOC>  man at the bar order the</DATELINE>";
>> $hello =~ s/<DOC>.*<\/DATELINE>//gi;
>> print "$hello\n";
>>
>
> I was about to say that you should use a module to parse your files but
> from what little you posted, it does not look like it's XML or even SGML.
>  Do you know what format your data is in?
>
>
> --
> Just my 0.00000002 million dollars worth,
>  Shawn
>
> Programming is as much about organization and communication
> as it is about coding.
>
> The secret to great software:  Fail early & often.
>
> Eliminate software piracy:  use only FLOSS.
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>

Reply via email to