in reply to Activestate open unix filehandle

You could do as ikegami says, or you could write an actual line feed character rather than \n. For example:

my $LF = "\x0a"; print "This line ends with a linefeed" . $LF;

update: Just do as ikegami says :-)

Replies are listed 'Best First'.
Re^2: Activestate open unix filehandle
by ikegami (Patriarch) on Mar 01, 2006 at 19:08 UTC

    That's incorrect. \n is \x0A in Windows. The convertion \x0A to \x0D\x0A happens in the PerlIO layers, so your trick doesn't work. Proof:

    >type !.pl my $LF = "\x0a"; print "This line ends with a linefeed" . $LF; >perl !.pl > ! >debug ! -rcx CX 0020 : -d100 l20 0B25:0100 54 68 69 73 20 6C 69 6E-65 20 65 6E 64 73 20 77 This line + ends w 0B25:0110 69 74 68 20 61 20 6C 69-6E 65 66 65 65 64 0D 0A ith a lin +efeed.. -q

      Indeed. I must be suffering a mild form of insanity. :-)

        You might have been thinking of the Mac where \n is \x0D (and \r is \x0A?). While using binmode and \n will work on Windows, using binmode and \x0A is required for portability.