|
Posted by ingy on December 2, 2005, 11:38 am
Please log in for more thread options
bijanmossadeghi@yahoo.com wrote:
> I have a Perl hash:
>
> %dictionary = (
> gema => [1],
> gemaadm => [1],
> admin => [1],
> Prague => [1],
> server => [1]
> );
>
> and an array:
>
> @data = (
> [gemaadm, abc123, "gema admin for Prague server"],
> [csvadm, abc123, "csv server in us"]
> );
>
> i loaded these data structures into files with YAML:
> YAML::DumpFile("dictionary.dat",\%dictionary);
> YAML::DumpFile("data.dat",\@data);
>
> when i read the data back into Perl and print them, the hahs keys
> comeout ok, but the values come out like ARRAY(0x8a3dfcc)
>
> %dictionary = %{ YAML::LoadFile("dictionary.dat")};
> print %dictionary;
>
>
adminARRAY(0x8a3df84)gemaARRAY(0x8a3dfb4)gemaadmARRAY(0x8a3dfcc)serverARRAY(0x8a3dfe4)PragueARRAY(0x8a40200)
>
>
> same thing with the array
>
> @data = YAML::LoadFile("data.dat");
> pritn @data;
>
> ARRAY(0x8b92594)
This has nothing to do with YAML. Try this Perl one liner:
perl -le 'print [1, 2, 3]'
This is just how Perl prints references. In other words, your code is
probably working fine, it's your debugging that needs help. :)
Cheers, Ingy
>
>
>
> question is, how do i get the hash values back into being arrays, and
> how do i get the array to come back into perl as an array?
>
> thanks.
|