What is the best way to find out the line endings used in a file? Something like the routine below will work but it's such a basic requirement that I presume there's a standard routine.
open F, $f or die $! ;
read F, $_, 257 ;
/\r/ and $/ = "\r" or $/ = "\n" ;
close F;
open F, $f ;
for (<F>) {
printf "# %s", $_ ;
}
JD
