in reply to Is there a variable in which Perl stores the native file delimiter for the platform on which your script is running?

With a suitably capable version of perl, you could:
my $newline = "\n"; $_ eq "crlf" and $newline = "\r\n" for PerlIO::get_layers(*STDOUT);
or, if they specify a terminator, use binmode and their selection, otherwise, don't use binmode and output "\n".
  • Comment on Re: Is there a variable in which Perl stores the native file delimiter for the platform on which your script is running?
  • Download Code

Replies are listed 'Best First'.
Re^2: Is there a variable in which Perl stores the native file delimiter for the platform on which your script is running?
by tye (Sage) on Dec 23, 2005 at 05:19 UTC
    my $newline = "\n"; $newline = "\r\n" if grep $_ eq "crlf", PerlIO::ge­t_layers(*­STDOUT);

    - tye