foreach my $id ( keys %data ){ foreach my $window ( 0 .. $#{$data{$id}} ){ next unless scalar @{ $data{$id}[$window] } >= 2;