sub find_holes { my @list = @{ shift() }; @list = sort { $a <=> $b } @list; my $low = $list[0]; my $high = $list[-1]; my @notfound; @notfound[$low..$high] = ($low..$high); $notfound[$_] = 0 for @list; my @vacancies = grep {$_} @notfound; return \@vacancies; }