delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/22/03:14:20

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <69E2FE062AA0D411BE9B00306E00E15220B68B@NL-GRH-MAIL01>
From: Arjen Bax <arjen DOT bax AT cmg DOT nl>
To: cygwin AT sourceware DOT cygnus DOT com
Subject: RE: Perl: Textmode vs. Binary mode...
Date: Thu, 22 Mar 2001 09:15:01 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)

Bob Heckel [mailto:BHeckel AT excite DOT com] wrote in answer to a question
from Mark Allan Young:

> Use this instead of "chomp" so that you don't have to worry about it:
> 
>   s/[\r\n]+$//;       # remove <CR> and/or <LF> from the end of $_

I stumbled into the same problem a wile ago and tried exactly this
solution, but it didn't work. The reason is, that the $ in the RE
matches (perldoc perlre):

    $   Match the end of the line (or before newline at the end)

so the line ending \n will not be removed. I ended up with

    s/[\r\n]+\z//;      # remove CR and/or LF at the end of $_

(and some time later replaced it with

    s/\s+\z//;          # remove whitespace at the end of $_

but that may not be what you want.)

HTH,
Arjen Bax
-- 
CMG Noord-Nederland B.V.
Sector Telecommunications & Utilities
Postbus 70237, 9704 AE  Groningen
Tel. (050)52 19 500, Fax (050)52 19 504
<http://www.cmg.nl> <http://www.cmg.com>

Adding manpower to a late software project makes it later.

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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