foreach keys %substitute_hash { $string =~ s/$_/$substitute_hash{$_}; }