Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by anazawa (Scribe)
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 drinking their drinks and smoking their pipes about the Monastery: (16)
As of 2015-07-31 15:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (279 votes), past polls