in reply to Case insensitive hash key existance
If you have an existing hash (thus fc is not an option), you can grep the key set against a case-insensitive regular expression:
This solves an immediate problem, though making sure your keys were well-formed in the first place would probably be cleaner.if(grep /^\Q$str\E$/i, keys %data) { # case-insensitive exists
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Case insensitive hash key existance
by Your Mother (Archbishop) on Nov 22, 2017 at 16:51 UTC | |
Re^2: Case insensitive hash key existance
by merrymonk (Hermit) on Nov 22, 2017 at 16:31 UTC | |
by ikegami (Patriarch) on Nov 22, 2017 at 17:09 UTC |
In Section
Seekers of Perl Wisdom