Is there any good way to read a file in a way that is independent of the newlines used in that file?
Mac typically uses CR line endings. Unix typically uses LF line endings. And DOS & Network (eg HTTP, FTP, etc) typically use CRLF line endings. Ideally, it would be possible to set $/ to something such that Perl would just do the right thing (when using <EXPR>), but this does not seem to be possible. Reading: http://www.perldoc.com/perl5.6/pod/perlport.html#Newlines is no use. It has the standard trick of using CR or LF and then stripping out the other one to hand CR & CRLF or LF & CRLF, but that trick does not work in the unfortunately now common case on Mac OS X of having to deal with both CR & LF. Short of writing my own readline function, of pre-reading a file and then figuring out the line ending, I can't think of any good/easy way to handle reading a text file that might have either CR or LF line endings. Does anyone know a good trick? Thanks, Peter. -- <http://www.interarchy.com/> <ftp://ftp.interarchy.com/interarchy.hqx>