Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 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) Content-Type: text/plain; charset="iso-8859-1" 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 and/or 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 Adding manpower to a late software project makes it later. -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple