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 Date: Thu, 8 Mar 2001 17:48:56 -0800 (Pacific Standard Time) From: Jason Tiller To: Subject: 'chop' and text mounts Message-ID: X-X-Sender: jdtiller AT shell3 DOT ba DOT best DOT com MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Hello, All, :) I have a feeling this is an extremely trivial question, but it's vexing to a relative newbie like me. I'm just starting to learn Perl, and I've run into a problem chop'ping lines that are CR/LF terminated. Very simple example. File 'a' has nothing but: 0000 0000 61 0D 0A a.. (Hex dump produced using a non-Cygwin tool.) My cwd is on a text-mode mount: /c/emtplus/code/HS $ mount Device Directory Type Flags C:\cygwin\bin /usr/bin system binmode C:\cygwin\lib /usr/lib system binmode C:\cygwin / system binmode a: /a user binmode c: /c user textmode d: /d user textmode (blah blah blah) I would expect that when Perl reads a line, Cygwin would give it a \n terminated line because I'm in text mode. Then chop() would remove that \n (if I understand how chop() is supposed to work!) Unfortunately, reading from the simple 'a' file above gives me this: $ perl -e 'open( A, "a" ); chop( $_ = ); print;' | xxd 0000000: 610d a. Reading it from STDIN gets me: $ perl -e 'chop( $_ = ); print;' < a | xxd 0000000: 610d a. I tried fiddling with "binmode" after reading perldoc, but to no joy: $ perl -e 'open( A, "a" ); binmode( A, ":crlf" ); chop( $_ = ); print;' | xxd 0000000: 610d a. I'm *sure* that tons of people have come up against this in the past. BTW, a search of the online perldoc didn't turn up much. I'm running on all the latest stuff (re-ran setup.exe a week or so ago). I realize I could do something like: s/\015$//; But I'd like to not have to. Thanks for any help y'all can provide! ---Jason Tiller jtiller AT sjm DOT com Sonos -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple