in reply to Regular Expression Fun

You tried:     $string !~ s/\d{10}//g; and asked "why can't I just reverse it?" What you wrote did reverse something. But, as you say, not what you intended.

What you wrote means, "do s/\d{10}//g and then return success if it failed." Although that sounds a little funny and is not what you intended, it could actually be useful. Perhaps this will help you conceptualize what is happening:

if ($string !~ s/\d{10}//g) { print "String unchanged: couldn't find 10 digits.\n"; # do stuff to deal with regex failure } else { print "All cases of 10 digits have been deleted.\n"; }
Of course if we really wanted that effect, we would probably want to avoid the easy-to-miss "!" and say either of the following:
if (not $string =~ s/\d{10}//g) { unless ($string =~ s/\d{10}//g) {
To achieve what you wanted, check out the other responses which have offered good solutions.

------------------------------------------------------------
"Perl is a mess and that's good because the
problem space is also a mess.
" - Larry Wall