Re: Detecting file's line endings

2005-12-22 Thread Peter N Lewis
At 15:15 + 22/12/05, James Harvard wrote: I'm trying to detect a file's line endings (\r\n for DOS, \r for Mac and \n for Unix as I'm sure y'all know). Is there any easy way to do this? use Fcntl; sub get_line_ending_for_file { my( $file ) = @_; my $fh; sysopen( $fh, $file, O_RDON

Re: Detecting file's line endings

2005-12-22 Thread Doug McNutt
At 15:15 + 12/22/05, James Harvard wrote: I'm trying to detect a file's line endings (\r\n for DOS, \r for Mac and \n for Unix as I'm sure y'all know). 52 kB 4

Re: Detecting file's line endings

2005-12-22 Thread John Delacour
At 3:15 pm + 22/12/05, James Harvard wrote: Is there any easy way to do this? PS. The whole script, from which Peter quoted only the last bit in providing his genial one-liner, was as follows: #!/usr/bin/perl $f = "$ENV{HOME}/Documents/Eudora Folder/Mail Folder/Manningham" ; sysopen

Re: Detecting file's line endings

2005-12-22 Thread John Delacour
At 3:15 pm + 22/12/05, James Harvard wrote: I'm trying to detect a file's line endings (\r\n for DOS, \r for Mac and \n for Unix as I'm sure y'all know). Is there any easy way to do this? At 10:45 am +0800 21/11/02, Peter N Lewis wrote: At 13:22 + 20/11/02, John Delacour wrote:

Detecting file's line endings

2005-12-22 Thread James Harvard
I'm trying to detect a file's line endings (\r\n for DOS, \r for Mac and \n for Unix as I'm sure y'all know). Is there any easy way to do this? I don't want to slurp the whole file, because it could be 14 MB or more, so I wanted to read in chunks until I got to a line break. However I can see a