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:
And of course, %translate is already declared and filled. However, I get the error: Global symbol "$translate" requires explicit package name. Help?foreach my $thing (keys(%translate)) { s/${thing}/${translate}{${thing}}/g; }
Back to
Seekers of Perl Wisdom