|Welcome to the Monastery|
Best Practice for replace subby Skeeve (Vicar)
|on Mar 01, 2013 at 09:59 UTC||Need Help??|
Skeeve has asked for the
wisdom of the Perl Monks concerning the following question:
I often find myself writing code like this:
Note: Please don't tell me about moduls being able to do exactly this encoding/replacements as this is just an example for several tasks where I need to replace substrings with other strings.
My bad feeling about this is: I'm using kind of global variables which I initialize once because I simply don't want to assign the hash (%ENCODE) and the accompanying scalar ($ENCODE) each time the encode($string) is invoked. So they need to be on global level. But it does not "feel right".
What's your proposal against this? Or what's your view on this?