You would have to escape $_ as it may contain regexp special characters. It also assumes "words" are delimited by whitespace and by \b at the same time - your program fails to find a match if $my_name=$db_name="Acidovorax sp. JS42" for instance.
Ouch! I guess I should learn to program before I start (mis)representing myself as someone who knows what he's talking about. I've updated the post with what I think might possibly work. Thanks for the heads up.