my $DATA; while (<>) { my ($obs, $det, $x, $y) = split(' ', $_); push(@{$DATA->{$obs}->{$det}}, {x => $x, y => $y}); }