Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: On creating hash whose keys aren't case-sensitive

by anazawa (Beadle)
on Feb 18, 2012 at 16:29 UTC ( #954765=note: print w/ replies, xml ) Need Help??


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; }


Comment on Re^2: On creating hash whose keys aren't case-sensitive
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://954765]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (18)
As of 2014-08-22 17:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (161 votes), past polls