in reply to hash ref and yaml

As I suspected, you have one label and refer to it twice:

use YAML; my $x = { Data => { a => 1, b => 2 } }; $x->{Trans} = [ $x->{Data}, $x->{Data} ]; print Dump( $x ); __END__ --- Data: &1 a: 1 b: 2 Trans: - *1 - *1

Replies are listed 'Best First'.
Re^2: hash ref and yaml
by shabtay (Initiate) on Feb 17, 2009 at 12:47 UTC
    But that's ok, what is not ok is that i have two
    different refers to the same label:

    ---
    Data: &1 &2
      a: 1
      b: 1
    Trans:
      - *1
      - *2

    Try to Load this YAML text above and you will get
    and error.

    Thanks,
    Eli
    http://eshsoftware.biz

      Perhaps I misunderstood your question.

      If you want to know whether a YAML document such as you have presented is valid, I suggest looking at the YAML spec to see what it says. I'm not a YAML expert, so I don't have any idea, myself.

      If you have a file like this and you want to get it loaded, I suggest fixing the file. You could also try loading it with different YAML implementations to see if any will take it.