how to convert the perl hash string reference to perl hash reference

若如初见. 提交于 2019-12-01 08:21:14

You can't convert this back.

The HASH(0x991f0dc) is not a hash reference. It is the string representation of a variable that contains a reference to a hash at that address. The error message you describe when you deref it points to that you have something similar to this:

my $foo = 'HASH(0x991f0dc)';
print %$foo;

Now that won't work, because the actual data structure is not there.

It looks like you got this over a socket that you read from through the GEN0 filehandle. Whoever sends you that data structure is doing something wrong.

They need to serialize the data, and then you need to deserialize it back. A good way to do that is JSON. But you could also use Storable, or Sereal.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!