while () { foreach my $key (keys %substitute_hash) { s/$key/$substitute_hash{$key}/g; } }