sub are_consecutive { my $i = $_[0]; $_ == $i++ or return 0 for @_; 1; } are_consecutive(@{$_}) or die "User can't count.$/" for values %hsh; my @big = sort {$a <=> $b} map {@{$_}} values %hsh; $big[0] == 0 && are_consecutive(@big) or die "Bad big.$/"; # originally had soln in terms of $big[0] == 0 and $big[-1] == $#big # rejected because equal number of missing and doubled terms not detected