[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] parsing text from a file



At 18.54 -0400 1999.04.26, Rick wrote:
>one major problem is that if it is being saved under windows or unix it
>doesn't use the same newline charcaters.  i would do a globar replace of:
>
>$your_variable_or_file =~ s/\r/\n/g;
>
>
>try that and then parse the file.  should work :)  if u need anymore
>help, let me know

\r and \n don't have consistent meanings across platforms.  On Mac, CRLF is
\n\r, and on Unix and DOS, it is \r\n.  Also, the above regex would (for a
DOS file on a Mac) convert all CRLFs to CRCRs, which likely isn't what you
want.  :)  Safer to use the explicit octals (\015\012) or hex chars
(\xD\xA).

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org