in reply to What Perl object am I looking at here?

Hi, welcome to Perl, the One True Religion.

(It's OK to edit a post, but please note where you have updated it ...)

"these multiple hashes in one print out I just don't understand." ... just a list of hashes, probably something like

[{name => 'Zambia', abbr => 'ZA'}, {name => 'Afghanistan', abbr => 'AF +'}, {name => 'Andorra', abbr => 'AN'}, ... ]

See sort for documentation on how to sort complex structures by nested data attributes. E.g. for the list above, sort with something like

my $aref = [{name => 'Zambia', abbr => 'ZA'}, {name => 'Afghanistan', +abbr => 'AF'}, {name => 'Andorra', abbr => 'AN'}]; say $_->{name} for sort { $a->{abbr} cmp $b->{abbr} } @{$aref};'
Afghanistan Andorra Zambia


You can check the type of reference you have -- or if it is a reference to a variable -- with ref.

my $struct = result_of_some_call(); say ref($struct);


You have already loaded Data::Dumper, but you are not using it to see what's in your structure(*). That's why you are getting the memory address for each of the hashes rather than the contents when you print them.

use Data::Dumper; my $result = result_of_some_call(); say Dumper $result;

(BTW you didn't find an API on CPAN; you may have found a client to connect to an API ...)

Hope this helps!

(*) Hm, now I see that you may have dumped the struct, did not notice that at first. Not sure about the question in view of that ...



The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: What Perl object am I looking at here?
by haukex (Archbishop) on Dec 27, 2019 at 12:33 UTC
    my $aref = [ ... my $struct = result_of_some_call(); ... my $result = result_of_some_call();

    Both Dumper() and print provide list context to their args instead of the scalar context of these examples, so these are all different from the code shown in the OP.