hi perl monks! I have a problem and i still didn't find out if it's a perl bug or a yaml module bug. if i write a code like that:
$x->{data} = 1;
$x->{abc} = $x;
print YAML::Dump( $x, $y );


The results will be:
---
- &1    # &1 shows us that we will meet a reference to this place.
  data: 1
- abc: *1    # *1 represent the reference to the &1 ($x)


in one of my perl application i saw a yaml file that look like that:
---
Data: &1 &2
  a: 1
  b: 2
Trans:
  - *1
  - *2


which means that i have 2 different references to the same data.
the problem is that the YAML module can't read this file and i get an error ( more then one anchor ) at the line that the "Data: &1 &2" present.

is there a way to crate tow different refs to the same data in an object?

i'll be happy if anyone here can give me a direction to start investigating this bug.

Thanks, Eli Shabtay
http://eshsoftware.biz

In reply to hash ref and yaml by shabtay

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.