Scroll to navigation

Hash::Case::Preserve(3pm) User Contributed Perl Documentation Hash::Case::Preserve(3pm)

NAME

Hash::Case::Preserve - hash with enforced lower cased keys

INHERITANCE

 Hash::Case::Preserve
   is a Hash::Case
   is a Tie::StdHash

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

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.

Extends "DESCRIPTION" in Hash::Case.

METHODS

Extends "METHODS" in Hash::Case.

Constructors

Extends "Constructors" in Hash::Case.

Define %hash to 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

 -Option--Default
  keep    'LAST'
    
Which casing is the preferred casing? The FIRST appearance or the LAST. Only stores will affect the casing, deletes will undo the definition. Defaults to LAST, which is slightly faster.

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.

2026-01-26 perl v5.40.1