use strict; use warnings; my $str = '2222222222 1234567890 0000000000 48192049281924 99999999999999'; my @matched = grep {! /^(\d)\1{9,}$/} $str =~ /\b(\d{10,})\b/g; print "@matched";