David Falck writes ..

>I tested something similar to your suggestion. I created the customer
>record on my laptop's Windows98 OS, and also on my web site's UNIX OS.
>Then I read one record and without chomp-ing (removing the input record
>separator), got the length for the record. On both operating systems,
>the length was 304. (No idea!) But I had to assign 2 to the $newline
>variable when on Windows for the seek to work -- seeking the record
>with an offset from the beginning of the file.
>
>I still haven't figured that one out. My record is 303 and length of
>record returns 304. Why... I just don't know.


on Win32 - when you read the file in using a text filehandle (ie. you have
not 'binmode'd it by using the binmode function) then Perl converts the OS's
native line-ending sequence to "\n" internally in Perl for everyone's
convenience

so .. once you've read it in - all the CRLFs have been converted to LFs ..
hence the match between UNIX and Win32 byte counts

HOWEVER .. within the file itself - there are still CRLFs in Win32 and plain
LFs in UNIX .. so the seek needs to take this into account .. because it's
acting directly on the file buffer

references:

  perldoc -f binmode
  perldoc -f seek

-- 
  jason king

  In South Carolina, merchandise may not be sold within a half mile of
  a church unless fruit is being sold. - http://dumblaws.com/

Reply via email to