in reply to Re^2: Salesforce Data Parser
in thread Salesforce Data Parser

You're very welcome, I'm glad it worked.

A little more info on when you said "is ALMOST an Array of Hashes". When printing with Data::Dumper, you always pass in a reference to the structure you're printing, so if the outermost part of the structure is an array (), it'll automatically get converted to [] in the output as you've passed in a reference to the array. In fact, the API itself returns the array as a reference in the first place, so you wouldn't need to take a reference to it when passing it into Dumper. These are equivalent when referring to Data::Dumper...

my @array = (1, 2, 3); print Dumper \@array;
my $aref = [1, 2, 3]; print Dumper $aref;

So it is really an Array of Hashes (AoH), it just looks a tiny bit different when the outermost part of the structure is a reference. You also need to access and use them slightly differently as well (by using dereference operators).

Replies are listed 'Best First'.
Re^4: Salesforce Data Parser
by bigdatageek (Novice) on Aug 06, 2015 at 17:11 UTC
    So is the dereference operator \@array or the use of ->?

      Take a reference (ie. make $aref a reference of @a):

      my $aref = \@a;

      Extract one element from the array ref by using -> deref operator:

      my $thing = $aref->[0];

      Use the array circumfix operator to dereference the whole array ref at once:

      my @b = @{$aref}; # used in loops, too

      I've proposed part of my reference howto as a tutorial here on PM. It may further help your understanding: Tutorial RFC: Guide to Perl references, Part 1.

        ahhh excellent, thanks for the reference! (no pun intended)