Home > Software design >  How to read HASH(0x1fcb970) using perl?
How to read HASH(0x1fcb970) using perl?

Time:05-04

I'm really lost with this, how can I read this response form an API HASH(0x1fcb970) using perl.

my @info= $connection->fetchrow();

When I try to print the data:

print @info 

is when I get the HASH.

CodePudding user response:

Something is a hash reference but is being treated as a string. When you stringify a reference, they get something like "HASH(0x1fcb970)" instead of what you intended. You see numbers but those aren't useful to you.

You might start by inspecting what you got:

use Data::Dumper;

print Dumper( \@info );

If you see what you expect there, then it's on your side to treat the reference properly.

If it's an error on the API side. Open a ticket with them and have them fix it.

There was a major newspaper that had this happen to them in 1990s, as I recalled. All of their headlines were "HASH(0x...)" for a couple of hours. :)

  • Related