die if @ref % 3; $out{$a} = [splice @ref,0,2] while $a = shift @ref;