my %edits = ( score => 'twenty', core => 'center', centre => 'center', centres => 'centers', travelled => 'traveled', "hasn't" => 'has not', Johann => 'John' ); my $pattern = '\b(' . join( '|', keys %edits ) . ')\b'; while () { s/$pattern/$edits{$1}/g; print; } __DATA__ fourscore and score years ago, we scored great scores with apple cores. it's time for an encore at the core of our cultural centre. in many centres where we travelled, Johann hasn't scored as well as he did in Johannesburg, where his score against Johannes Brahms shook us to our cores.