($obs, $det, $x, $y) = split /\ /; push @{ $histx{$obs}{$det} }, $x; push @{ $histy{$obs}{$det} }, $y; } for my $i (0..$#{ $histx{$obs}{$det} }) { print "${ $histx{$obs}{$det} }[$i]\n"; }