use strict; use warnings; my $foo = "The frog kissed the woman and became a man."; print "$foo\n"; my %replace = ( "frog" => "toad", " man" => " boy", "woman" => "girl" ); foreach my $find (keys %replace) { $foo =~ s/$find/$replace{$find}/; } print "$foo\n";