Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
"be consistent"
 
PerlMonks  

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

by ysth (Canon)
on Dec 22, 2005 at 23:17 UTC ( [id://518694]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 00:19 UTC
    my $newline = "\n"; $newline = "\r\n" if grep $_ eq "crlf", PerlIO::ge­t_layers(*­STDOUT);

    - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://518694]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.