if ($line =~ /^0/) { my $end = substr ($line, 10); unless ($end =~ /[^0-9\t]/ || $end =~ /\t\t/ || $end =~ /[0-9]{21}/) { .... } }