in reply to Array of Hashes to Hash of arrays for SQL::Abstract

You have not specified exactly what is required for your 'missing keys' test case. There is a very subtle difference between $data_hash->{c}->[2] = undef and $data)hash->{c}->[2] does not exist. I assumed that it should be undef. This requires setting the length of the arrays. The following test passes. Try commenting out the statement with '# Set length'. Observe how the test fails.
use strict; use warnings; use Test::More tests=>1; my $data = [ {a => 1, b => 2, c=>11}, {a => 3, c=>12}, {a => 5, b => 6}, ]; my $required = { a => [1, 3, 5 ], b => [2, undef, 6 ], c =>[11, 12, undef], }; my $data_hash; foreach my $i (0..$#$data) { while ((my $key, my $value)= each %{$data->[$i]}) { $#{$data_hash->{$key}} = $#$data; # Set length $data_hash->{$key}->[$i] = $value; } } is_deeply($data_hash, $required, 'missing keys');

Of course, if you require c => [11, 12] then the "set length" statement must be omitted.

Bill