in reply to string substitution
I may be wrong, but it sounds like you only want to replace BAD with HELL when BAD is a whole word.(e.g. you don't want "BADGER" to become "HELLGER"). If that is the case you might want to look at "\b" in "perldoc perlre"