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 From: "Christopher Rath" To: "Cygwin Maillist" Cc: "Max Bowsher" Subject: RE: Perl, text files, & \r Date: Sat, 7 Jul 2001 23:13:47 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2462.0000 In-Reply-To: <012a01c1072c$a263f5e0$83fafea9@tiny450> Max, thanks for the pointer. While your specific thought isn't correct---that Perl somehow translates "\n" when dealing with $\ or $/---double checking my understanding did cause me to stumble upon the solution: use of the 'binmode' command. If I modify my code as follows, it will work under both UNIX and Windows/MS-DOS: Instead of while(<>) { # do some funky stuff print $_; } Write: binmode ARGV; while(<>) { # do some funky stuff print $_; } and all will be well. I think this should be in the Cygwin FAQ. Why this works can be found on pp. 53-55 and 147 of "Programming Perl 2nd Ed.". Cheers, Christopher =========== Christopher Rath == (613) 824-4584 =========== 1371 Major Rd., Orleans, ON, Canada K1E 1H3 =============== mailto:christopher AT rath DOT ca =============== ``Hydrogen is a colourless, odourless gas which, given enough time, turns into people.'' --- Henry Hiebert ================== http://www.rath.ca/ =================== -----Original Message----- From: Max Bowsher [mailto:max AT bowshernet DOT freeserve DOT co DOT uk] Sent: 7 July, 2001 17:35 To: Cygwin Maillist Subject: Re: Perl, text files, & \r > I've tried forcing $\ to "\n", but that didn't help. Read the perl docs! "\n" in a $\ or $/ context is automagically translated into the default system line ending by perl. Using an octal code should avoid this, I think. Max. -- 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/