Well, first of all, redefining the hash *would* get rid
of Apple => red, but that's probably not what you meant. :)
In a thread a while back, vroom wrote a nice solution
using tie: Re: case sensitivity in hashes.
You'll have to modify it a bit, because you want multi-
dimensional hashes; so I think you'd probably just have
to tie all of the hashes of hashes of hashes, etc.
So, for example, say you're using vroom's
Tie::CaseInsensitive:
use strict;
my %HASH;
use Tie::CaseInsensitive;
tie %HASH, 'Tie::CaseInsensitive';
$HASH{BoB} = 1;
$HASH{bob} = 2;
$HASH{BOb} = 3;
tie %{$HASH{bill}}, 'Tie::CaseInsensitive';
$HASH{bill}{jones} = 3;
$HASH{BILL}{JONES} = 2;
use Data::Dumper;
print Dumper \%HASH;
You should get:
$VAR1 = {
'bill' => {
'jones' => 2
},
'bob' => 3
};
which looks quite right.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.