I’ve question with perl hashes, any advice on this is greatly appreciated- below is just the code snippet —
my @results = $sp->get_list_items($listid, $viewid);
print Dumper @results;
output is something like this,
$VAR1 = { a => 1, b => 2, g => 1, };
$VAR2 = { c => 1, d => 2, g => 1, b => 1434, h => 2 };
$VAR3 = { e => 1, a => 232, f => 2 };
$VAR4 = { g => 1, h => 2, a => 5, b => 19 };
Note: it’s a semicolon and not comma between the hash references!! My task is to gather a and b values from each hashref(replace it by 0 if a or b doesn’t exist in a hashref) and store it in a hash, it’s easy if hashrefs are joined by comma since it’s a semicolon it made this real tough for me in spite of multiple trials, please help..
You are misinterpreting the output of
Data::Dumper. You need to send the array ref to the Dumper function:Otherwise, you send the list of elements in the array to be printed individually.
You should get output like this: