Thanx toolic, indeed I have to read this thoroughly.

I was actually looking for a way to display the difference between deep and flat copy to a newbie, and no figured out that the Seen-Mechanism in Data::Dumper already reveals it, without the need to print the Ref-IDs. 8)

DB<90> $hr2={%$hr1} # shallow copy DB<91> print Data::Dumper->Dump([$hr1,$hr2],[qw/hr1 hr2/]) $hr1 = { 'a' => { 'b' => { 'c' => 1 } } }; $hr2 = { 'a' => $hr1->{'a'} }; DB<92> x $hr1,$hr2 0 HASH(0x8b64b78) 'a' => HASH(0x8b64c18) 'b' => HASH(0x8af9120) 'c' => 1 1 HASH(0x8b156c0) 'a' => HASH(0x8b64c18) -> REUSED_ADDRESS

Anyway IMHO an option to add the IDs as comments would be welcomed by many people as a valuable feature!

(update: maybe this can be done with Data::Dump::Streamer?)

Cheers Rolf

UDPATE: improved code example


In reply to Re^2: Making Data::Dumper also displaying (stringified) Ref-ID's? by LanX
in thread Making Data::Dumper also displaying (stringified) Ref-ID's? by LanX

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.