my $x = [ your input ]; my %y; push @{ $y{ delete $_->{ people_id } } }, $_ for @$x;