# @ref is the returned array for ( 0 .. $#ref / 3 ){ my $m = $_ * 3; $out{$ref[$m]} = [ @ref[$m+1, $m+2] ]; }