delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/07/23/01:57:53

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Tue, 23 Jul 2002 14:03:01 +0800
From: Greg Matheson <lang AT ms DOT chinmin DOT edu DOT tw>
To: cygwin AT cygwin DOT com
Subject: Re: perl & \n (was: perl-5.8.0 breaks code "working" on 5.6.1 over "\n"
Message-ID: <20020723140301.B44140@ms.chinmin.edu.tw>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20020719105932 DOT A11717 AT ms DOT chinmin DOT edu DOT tw> <20020722150604 DOT A85877 AT ms DOT chinmin DOT edu DOT tw>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i

This is a table of the results of my experiments with different
handling of \n by perl-5.6.1 and perl-5.8.0.

The code:

#!/usr/bin/perl

# sysopen(O, q/file/, O_WRONLY|O_CREAT|O_TEXT);       # open line 1
# open O, q/>file/;      # open line 2
# binmode O, ':raw';    # open line 3

print O "123\n567\n"; close O;
open I, q/file/;
while ( <I> ) { $string .= $_; }
print "String length: @{[length($string)]}\nFile size: @{[-s q/file/]}\n";
~                                                                               
~                                                                               
~
                  |   Default   |   Force     |    Force
                  |             |   Binary    |    Text
                  |-------------|-------------|---------------------
                  |String| File |String| File |String| File
------------------|-------------|-------------|--------------------
                  |      |      |      |      |      |   
Win32 (perl-5.6.1)|   8  | 10   |   8  |  8   |   -  |  -
                  |    (Text)   |      |      |      |   
------------------|-------------|-------------|--------------------
      |           |      |      |      |      |      |   
      |perl-5.6.1 |  10  |  10  |   8  |  8   |   8  |  8      
      |           |      |      |      |      |      |   
cygwin|-----------|-------------|-------------|--------------------
      |           |      |      |      |      |      |   
      |perl-5.8.0 |   8  |  10  |   8  |  8   |   8  | 8(10)
      |           |      |      |      |      |      |   

The figure in parentheses is in the case where the file has a
'.txt' extension.

I still have to check the effects of the underlying mount mode
and of setting PERLIO. The default result with 5.8.0 and the last
result with the file extension are different from what I said I
got before, so a mistake in my testing is likely somewhere. Or,
could be related to what the underlying mount mode is.

-- 
Greg Matheson                All teaching is teaching 
Chinmin College              under difficult circumstances.

Taiwan Penpals Archive <URL: http://netcity.hinet.net/kurage>

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019