http://www.perlmonks.org?node_id=1006270

Mr. Newb has asked for the wisdom of the Perl Monks concerning the following question:

So I have a hash, %translate, with key $string1 and value $string2 (there are, of course, multiple of these key/value pairs). I need to look at a line and translate all occurences of $string1 into $string2, so i did:
foreach my $thing (keys(%translate)) { s/${thing}/${translate}{${thing}}/g; }
And of course, %translate is already declared and filled. However, I get the error: Global symbol "$translate" requires explicit package name. Help?