my %hash; for my $item (@$list_of_hashes) { for my $key (keys %$item) { if ($key =~ m/^ID2\./) { $hash{ $key } = $item->{ $key }; last; } } }