Hash::...eserve(3pm)
π NAME π
Hash::Case::Preserve β a hash with enforced lower cased keys, no cap π«Ά
(also, hi bestie, this page is from the User Contributed Perl Documentation section, and the man page header/footer is a little shy so it shows up as Hash::...eserve(3pm) π
)
πΈ INHERITANCE πΈ
okay so the family tree is literally this:
Hash::Case::Preserve
is a Hash::Case
is a Tie::StdHash
she's got lineage, periodt π
β¨ SYNOPSIS β¨
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
look at her go π storing the key exactly how you typed it but matching it no matter how you scream it back. iconic behaviour, honestly.
π¦ DESCRIPTION π¦
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. π
(yes bestie, the original really does spell it "trics" and "case-insentive" β we keep the lore exactly as it is π«Ά)
Extends "DESCRIPTION" in Hash::Case.
π METHODS π
Extends "METHODS" in Hash::Case.
π§ Constructors
Extends "Constructors" in Hash::Case.
tie %hash, 'Hash::Case::Preserve', [$values,] %optionsβ define%hashto be case insensitive, but case preserving. The hash is initialized with the$values, specified as ARRAY (passing flat key-value pairs) or HASH. Improves base, see"Constructors" in Hash::Case.
Here's the options table, bestie, exactly as written:
-Option--Default
keep 'LAST'
keep => 'FIRST'|'LAST'β which casing is the preferred casing? TheFIRSTappearance or theLAST. Only stores will affect the casing, deletes will undo the definition. Defaults toLAST, which is slightly faster. β‘
ngl the keep option is the whole main character of this module, so pick your casing era wisely π
π Hidden object access
Extends "Hidden object access" in Hash::Case.
$obj->addHashData(\%data)β Inherited, see"Hidden object access" in Hash::Case$obj->addPairs(@pairs)β Inherited, see"Hidden object access" in Hash::Case$obj->setHash(\%data)β Inherited, see"Hidden object access" in Hash::Case
π SEE ALSO π
This module is part of Hash-Case version 1.07, built on January 26, 2026. Website: http://perl.overmeer.net/CPAN/ π¦
π LICENSE π
For contributors see file ChangeLog.
This software is copyright (c) 2002-2026 by Mark Overmeer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay that's the whole page, you ate that π β¨
perl v5.40.1 Β· 2026-01-26 β and that's the footer date and Perl version, mwah, go forth and tie your hashes bestie ππ
π¦ where this page comes from
- ubuntu resolute: libhash-case-perl 1.070-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libhash-case-perl 1.070-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms