my %repl= ( frog=>"toad", man=>"boy", woman=>"girl" ); $foo =~ s/(frog|man|woman)/$repl($1)/g;