in reply to
Stupid mistakes I repeatedly make
No matter how often I remind myself that s/// does not return the string, my fingers still type the code as if it does.
This problem becomes even more notorious, when you have to use PHP once in a while, and you get used to the familiar behavior of preg_replace. preg_replace does exactly what you wrote, that is, it returns the replaced string. I know, it has come up before many times here, but for me that PHP-ish behavior is much more natural. This does not generalize to PHP itself, though...