Reduce a ton of noise by eliminating quotes in hash keys when they don't contain anything other than alphanum and underscore. This: $vars{'error'} becomes this: $vars{error}
The reasons I single quote hash keys are:
I think of 3 in the same way I been told that:
is better than:if ($condition) { $var = 1; }
because we might want to add another statement into the code block.$var = 1 if $condition;
Likewise, I feel:
is better than:$vars{'example'} = 1;
because we can expand it easily if necessary and create something like:$vars{example} = 1;
$vars{'example' . $count} = 1;
Others may have different opinions, clearly they do as there is a lot of code with unquoted hash keys, but this works for me in terms of clarity, expandability and maintainability. I don't see any downside to is on performance (please correct me if there is!) so I think I shall keep this one the way it is.
In reply to Quoted hask keys (was: Re^2: What to test in a new module)
by Bod
in thread What to test in a new module
by Bod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |