in reply to Efficient selection mechanism?

about regexpes,as ikegami offered,
my humble imput, turn every number into a letter from a to t
0 - 19 and match the original line upon every:
$v[$i++] = $_ for 'a'..'t'; @a = qw/2 13 3 16/; $a = join '', map {$v[$_]} @a; #generating 1 000 000 base of numbers for (0..1000000){ %rnd = (); while(keys %rnd < 4){$rnd{$v[int(rand(20))]} = undef;} push @b, join '', keys %rnd; } #doing search for (@b){ $counter++ if !/[$a]/; } print "$counter\n";
on my pc
1 000 000 base generated in 4 seconds,
search upon it done in 1 second
around ~370 000 unique numbers.