How can I make hash key lookup case-insensitive?

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?

Answers


You will have to use a tied hash. For example Hash::Case::Preserve.


Need Your Help

UITableViewCell and UIImageView

iphone objective-c uitableview uiimageview

I'm currently trying to fix the performance of my UITableView. Basically all it is is a custom UITableViewCell with a UIImageView.