in reply to Extracting data from json object
Hi,
one key point: The output of Data::Dumper should be valid Perl code, so you have the following snippet to interpret:
$VAR1 = [ { 'acc_name' => 'EX3000', 'acc_po_ref' => 'qwerty', 'acc_expires' => undef, 'acc_email' => 'ex3000@mail.com', 'acc_id' => 0, 'acc_phonenum' => '0121777777', 'acc_cust_id' => 17 } ];
Go from the outer to the inner of your construct. The variable $VAR is assigned a pair of square brackets, that means an array ref, in that is a pair of curly bracket, that means a hash ref. So you have a reference to an array having exactly one element (an hash(ref)). In that hash you have the expected assignments from key to value.
Now to the derefencing. You have to get the first array element and from that tha value of a hash key:
print $VAR->[0]->{'acc_name'};
To remember: Decompose from the outer to the inner.
McA
|
|---|