in reply to Check for sequential values in an array that can contain duplicate int values
Here's one way to do it:
hth,my @a=qw(1 2 3 4 6 3 1); my %h = map {$_=>1} @a; my ($max) = reverse sort keys %h; for (1..$max) { print "gap at $_ \n" unless exists $h{$_} }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Answer: Check for sequential values in an array that can contain duplicate int values
by blakem (Monsignor) on Dec 17, 2001 at 03:47 UTC |