I've often seen code that, although it doesn't care about the exact number of replacements, it cares about whether a replacement was made (the number would be 0 or 1 since it's not a global replacement). This is typically used for tokenizing by deleting the tokens from a string (note: this might not very efficient for long strings!). The following is a simple example for tokenizing a space-delimited list of numbers.
$s = "213 3218 213";
while ($s =~ s/^(\d+)\s*//) {
print "$1\n";
}
if (length $s) {
print "Error! didn't expect this: '$s'\n";
}
This contrived example could probably be done more simply in other ways, but for more complicated tokenizers it is not such a bad approach.