How can I make hash key lookup case-insensitive?

Posted by mseery on Stack Overflow See other posts from Stack Overflow or by mseery
Published on 2008-11-21T20:14:21Z Indexed on 2010/05/22 5:00 UTC
Read the original article Hit count: 156

Filed under:
|

Evidently hash keys are compared in a case-sensitive manner.

$ perl -e '%hash = ( FOO => 1 ); printf "%s\n", ( exists $hash{foo} ) ? "Yes" : "No";'
No

$ perl -e '%hash = ( FOO => 1 ); printf "%s\n", ( exists $hash{FOO} ) ? "Yes" : "No";'
Yes

Is there a setting to change that for the current script?

Thanks.

© Stack Overflow or respective owner

Related posts about perl

Related posts about hash