in reply to Elegance, dammit!
Purely for completeness.
Option 1:
or if the temporary bothers you:while (@ref) { my $k = shift(@ref); $out{$k} = [ shift(@ref), shift(@ref) ]; }
while (@ref) { $out{$_} = [ shift(@ref), shift(@ref) ] for shift(@ref); }
Option 2: Change your SQL to something like SELECT key, value1, key, value2, then do:
Personally, I'd stick with your original.push @{ $out{shift(@ref)} }, shift(@ref) while (@ref);
In Section
Seekers of Perl Wisdom