Perhaps something like this?
#!/usr/bin/perl -w use strict; my @nums=qw(16 107 108 110 112 114 115 117 118 119 120 121 122 123 124 + 125 127 128 130 132 133 135 136 138 142 146 149 150 154 156 157 158 +159 161 162); my $limit = 4; my ($prev, $top) = shift @nums; for (@nums){ if ($prev + 1 == $_){ if (++$top == $limit){ die "Sequence of $limit found between @{[$_-$limit]} and $ +_\n"; } } else { $top = 0; } $prev = $_; }
-- Education is not the filling of a pail, but the lighting of a fire. -- W. B. Yeats
In reply to Re: find the continuity in the data file
by oko1
in thread find the continuity in the data file
by extrem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |