Interesting. I didn't realize dump/pp would put different hash keys etc on the same long line because it my "real" case it printed like below. I guess it's because all of the contents of the 'cell' hash key didn't fit within the value of $Data::Dump::LINEWIDTH I used which was 640,000. However, I'm not sure why it decided not to put some of the other hash keys/values on the same line. I just tried it with 1,000,000 and it did print the whole structure on a single line like in your example. If you set $Data::Dump::LINEWIDTH = 10 in your example, it prints like your "new dump string". It looks like you can just play around with the LINEWIDTH until you get what you want.

EDIT: Regarding the comment "However, I'm not sure why it decided not to put some of the other hash keys/values on the same line.", it seems that if a particular item at a given level is deserving of its own line then all items at that level are.

{ active => 0, attr => [], cell => [ [], [undef, "Peptide Groups P> [undef, "Checked", "FALSE> [undef, "Confidence", "Hi> [undef, "Annotated Sequen> [undef, "Modifications", > [undef, "Qvality PEP", 6.> [undef, "Qvality q-value"> [undef, "# Protein Groups> [undef, "# Proteins", 1, > [undef, "# PSMs", 3, 6, 1> [undef, "Master Protein A> [undef, "Positions in Mas> [undef, "Modifications in> [undef, "# Missed Cleavag> [undef, "Theo. MH+ [Da]",> [undef, "Abundance: F667:> [undef, "Abundance: F668:> [undef, "Abundance: F669:> [undef, "Abundance: F670:> [undef, "Quan Info", unde> [undef, "Found in Sample:> [undef, "Found in Sample:> [undef, "Found in Sample:> [undef, "Found in Sample:> [undef, "Confidence (by S> [undef, "Percolator q-Val> [undef, "Percolator PEP (> [undef, "XCorr (by Search> [undef, "Top Apex RT [min> ], hidden => 0, label => "combined", maxcol => 29, maxrow => 3941, merged => [], mincol => 1, minrow => 1, parser => 0, }

In reply to Re^2: Data::Dumper print arrays of scalars on one line by Danny
in thread Data::Dumper print arrays of scalars on one line by Danny

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.