You forgot the input layer. This works:
use strictures; use autodie qw(:all); my $infile = 'crlf.txt'; my $outfile = 'out.txt'; open my $in, '<:crlf', $infile; open my $out, '>:raw', $outfile; while (<$in>) { chomp; printf {$out} '%-200s', $_; } close $in; close $out;
Edit: add hexdumps
$ hex crlf.txt
0000  66 6f 6f 0d 0a 62 61 72  0d 0a 62 61 7a 0d 0a     foo␍␊bar␍␊baz␍␊

$ hex out.txt
0000  66 6f 6f 20 20 20 20 20  20 20 20 20 20 20 20 20  foo
0010  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0020  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0030  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0040  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0050  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0060  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0070  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0080  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0090  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
00a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
00b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
00c0  20 20 20 20 20 20 20 20  62 61 72 20 20 20 20 20          bar
00d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
00e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
00f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0100  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0110  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0120  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0130  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0140  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0150  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0160  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0170  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0180  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0190  62 61 7a 20 20 20 20 20  20 20 20 20 20 20 20 20  baz
01a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
01b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
01c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
01d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
01e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
01f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0200  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0210  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0220  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0230  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0240  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20
0250  20 20 20 20 20 20 20 20

In reply to Re: Write padded output without newline by daxim
in thread Write padded output without newline by firmament

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.