The following module was proposed for inclusion in the Module List:
modid: Tie::CsPrefHash
DSLIP: bdprp
description: Prefer case-sensitive allow case-insensitive
userid: MIKO (Miko O'Sullivan)
chapterid: 6 (Data_Type_Utilities)
communities:
similar:
rationale:
NAME
Tie::CsPrefHash - Prefers case-sensitive, allows case-insensitive
SYNOPSIS use Tie::CsPrefHash; my (%hash);
tie %hash, 'Tie::CsPrefHash';
# put several elements in using # different case variations of
"Fred" $hash{'Fred'} = 'Title'; $hash{'fred'} = 'lower';
$hash{'FRED'} = 'UPPER';
# output "UPPER" print 'FRED: ', $hash{'FRED'}, "\n";
# output one of the Fred variations # no promises on which one
print 'frED: ', $hash{'frED'}, "\n";
# output all three elements while (my($key, $val) = each(%hash))
{print $key, ': ', $val, "\n"}
DESCRIPTION
Tie::CsPrefHash creates a hash that compromises between
case-sensitive and case-insensitive. In most regards, CsPrefHash
creates a normal hash: elements are stored using case-sensitive
keys. If you put an element in and pull it back out using exactly
the same key, you'll get exactly the same value. Keys that are
different only in their upper/lowercase configuration are still
considered different keys.
Where Tie::CsPrefHash is different than regular hashes is that if
an element is requested using a key that does not exist
case-sensitively but does exist case-insensitively, then the
existing element is returned. If more than one element matches on a
case-insensitive basis, then one of them is arbitrarily chosen and
returned.
enteredby: MIKO (Miko O'Sullivan)
enteredon: Mon Aug 12 22:07:09 2002 GMT
The resulting entry would be:
Tie::
::CsPrefHash bdprp Prefer case-sensitive allow case-insensitive MIKO
Thanks for registering,
The Pause Team
PS: The following links are only valid for module list maintainers:
Registration form with editing capabilities:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=0d100000_2316ae468951eba2&SUBMIT_pause99_add_mod_preview=1
Immediate (one click) registration:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=0d100000_2316ae468951eba2&SUBMIT_pause99_add_mod_insertit=1