in reply to
Re: On creating hash whose keys aren't case-sensitive
in thread On creating hash whose keys aren't case-sensitive
Thanks for your suggestion.
Tie::Hash::Regex interests me.
I confirmed your regex passed the following test:
# tie_hash_regex.t
use strict;
use Tie::Hash::Regex;
use Test::Simple tests => 8;
my @keys = qw(
content-length
content_length
-content-length
-content_length
Content-Length
Content_Length
-Content-Length
-Content_Length
);
for my $key ( @keys ) {
my %hash;
tie %hash, 'Tie::Hash::Regex';
$hash{ $key } = 1234;
ok $hash{'^(?i:-?content[_-]length)$'} == 1234;
}