Andrew Brosnan wrote:
I'm processing a string with embedded newlines. For testing I was
storing the text in __DATA__ and slurping it into a string. This works
fine. However when I read in a file, I'm having trouble with the line
endings. Matching begining/end of logical lines is not working as I
expect. Regexes like the one below match when using the DATA filehandle,
but don't when opening other text files on my Mac.

    $text =~ s/^Text to match.*$//m;

Is this due to UNIX '\n' vs. Mac '\r' line endings? I assumed the 'm'
modifier would recognize any line ending.

Oh what to do?

Andrew

What version of the Mac? Anything in the OSX family is Unix and uses the standard "\n" line ending/new line. If you brought the files over then yes you are going to have the '\r' line ending.

:Robert

Reply via email to