use strict; my @array = ( "1.found", "2.found", "4.found", "5.found", "6.found", "8.found", ); my $counter = substr($array[0], 0, 1); for (@array) { my ($num) = /^(\d+)/; if ($counter < $num) { print "$counter.lost\n"; $counter = $counter + 2; } else { $counter++; } }