Hash with enforced lower cased keys
Hash::Case::Preserve is a Hash::Case is a Tie::StdHash
use Hash::Case::Preserve; tie my(%cphash), 'Hash::Case::Preserve'; $cphash{StraNGeKeY} = 3; print keys %cphash; # StraNGeKeY print $cphash{strangekey}; # 3 print $cphash{STRANGEKEY}; # 3
Hash::Case::Preserve extends Hash::Case, which lets you play various trics with hash keys. This extension implements a fake hash which is case-insentive. The keys are administered in the casing as they were used: case-insensitive but case-preserving.
See \*(L"Constructors\*(R" in Hash::Case See \*(L"Constructors\*(R" in Hash::Case See \*(L"Constructors\*(R" in Hash::Case
Define \s-1HASH\s0 to be case insensitive, but case preserving. The hash is initialized with the \s-1VALUES\s0, specified as ref-array (passing a list of key-value pairs) or ref-hash. \s-1OPTIONS\s0 is a list of key/value pairs, which specify how the hash must handle preservation. Current options: -Option--Default keep 'LAST'
Which casing is the preferred casing? The \s-1FIRST\s0 appearance or the \s-1LAST\s0. Only stores will affect the casing, deletes will undo the definition. Defaults to \s-1LAST\s0, which is slightly faster.
This module is part of Hash-Case distribution version 1.02, built on March 09, 2012. Website: http://perl.overmeer.net/hash-case/
Copyrights 2002-2003,2007-2012 by Mark Overmeer. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html