Name : perl-Tie-CPHash
| |
Version : 2.000
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp154.3.1
| Date : 2023-01-27 18:22:32
|
Group : Development/Libraries/Perl
| Source RPM : perl-Tie-CPHash-2.000-lp154.3.1.src.rpm
|
Size : 0.03 MB
| |
Packager : https://www_suse_com/
| |
Summary : Case preserving but case insensitive hash table
|
Description :
The Tie::CPHash module provides a hash table that is case preserving but case insensitive. This means that
$cphash{KEY} $cphash{key} $cphash{Key} $cphash{keY}
all refer to the same entry. Also, the hash remembers which form of the key was last used to store the entry. The \'keys\' and \'each\' functions will return the key that was used to set the value.
An example should make this clear:
tie %h, \'Tie::CPHash\', Hello => \'World\'; print $h{HELLO}; # Prints \'World\' print keys(%h); # Prints \'Hello\' $h{HELLO} = \'WORLD\'; print $h{hello}; # Prints \'WORLD\' print keys(%h); # Prints \'HELLO\'
Tie::CPHash version 2.000 introduced the ability to pass a list of \'key => value>>> pairs to initialize the hash (along with the \'add\' method that powers it). The list must include a value for each key, or the constructor will croak.\'
The additional \'key\' method lets you fetch the case of a specific key:
print tied(%h)->key(\'Hello\');
(The \'tied\' function returns the object that \'%h\' is tied to.)
If you need a case insensitive hash, but don\'t need to preserve case, just use \'$hash{lc $key}\' instead of \'$hash{$key}\'. This has a lot less overhead than Tie::CPHash.
\'use Tie::CPHash;\' does not export anything into your namespace.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-T/15.4/noarch |