> use the tool you know best, first.

Let me teach you another lesson here, equally important. If the output is weird, check the input.

You mention cygwin, which adds some hints. The input contains MSWin32 EOL characters, so xxd shows it as

00000000: 4350 414e 3a3a 4d65 7461 0d0a 4578 7455 CPAN::Meta..ExtU 00000010: 7469 6c73 3a3a 4275 696c 6465 720d 0a45 tils::Builder..E 00000020: 7874 5574 696c 733a 3a42 7569 6c64 6572 xtUtils::Builder 00000030: 3a3a 436f 6d70 696c 6572 0d0a 4578 7455 ::Compiler..ExtU 00000040: 7469 6c73 3a3a 436f 6e66 6967 0d0a 4578 tils::Config..Ex 00000050: 7455 7469 6c73 3a3a 4865 6c70 6572 730d tUtils::Helpers. 00000060: 0a45 7874 5574 696c 733a 3a49 6e73 7461 .ExtUtils::Insta 00000070: 6c6c 5061 7468 730d 0a47 6574 6f70 743a llPaths..Getopt: 00000080: 3a4c 6f6e 670d 0a4c 6973 743a 3a55 7469 :Long..List::Uti 00000090: 6c0d 0a54 4150 3a3a 4861 726e 6573 730d l..TAP::Harness. 000000a0: 0a .

Do you see those 0d bytes? Strawberry Perl (or any other perl compiled on MSWin) would recognise them, but cygwin Perl is of the *nix kind, so it expects 0a only.

The output you got was not exactly what you thought. The newlines were correctly replaced by spaces, but the carriage returns remained in the data, causing the cursor to return left and overwrite the text again and again.

tr '\n' ' ' < input| xxd 00000000: 4350 414e 3a3a 4d65 7461 0d20 4578 7455 CPAN::Meta. ExtU 00000010: 7469 6c73 3a3a 4275 696c 6465 720d 2045 tils::Builder. E ...

You see? We have 20 (the space) there, but it's preceded by 0d.

What would I use? Any of the following:

perl -pe 'tr/\n\r/ /d' perl -pe 's/\s+/ /' tr -s '\n\r' ' '

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

In reply to Re: A Christmas detour: it's the simplest damn things that bite us sometimes by choroba
in thread A Christmas detour: it's the simplest damn things that bite us sometimes by Intrepid

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.