|
|
| P is for Practical | |
| PerlMonks |
Re: On creating hash whose keys aren't case-sensitiveby CountZero (Chancellor) |
| on Feb 18, 2012 at 12:50 UTC ( #954748=note: print w/ replies, xml ) | Need Help?? |
|
Following the maxim of "be strict with your output, but liberal with your input", it is a Best Practice™ to always check, sanitize and normalize your input. And just for the fun of it: your _lc rewritten into one regex: This sub returns undef (indicating an error) if you give it a string with more than one internal dash or underscore. CountZero A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James My blog: Imperial Deltronics
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||