Thanks for the replies so far. My version is 9999.09, which is current. Passing the
binmode parameter doesn't change anything.
Here is another test:
use strict;
use warnings;
use File::Slurp;
my $file_slurp = read_file('file');
my $normal;
{
local $/;
open my $FILE, '<', 'file' or die $!;
$normal = <$FILE>;
close $FILE;
}
write_file('slurp', $file_slurp);
open my $NORMAL, '>', 'normal' or die $!;
print $NORMAL $normal;
close $NORMAL;
open my $SLURP_NORMAL, '>', 'slurp_normal' or die $!;
print $SLURP_NORMAL $file_slurp;
close $SLURP_NORMAL;
Doing this, both normal and slurp end up with the file identical to the original, but slurp_normal has the "added" newlines. So something in File::Slurp is "correcting" whatever it did to begin with when I use write_file. I'm puzzled.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.