Acme-CPANModules-HashUtilities
view release on metacpan or search on metacpan
%hash = (a=>1, b=>2);
%reverse = reverse %hash; # => (2=>"b", 1=>"a")
Since the new keys can contain duplicates, this can "destroy" some old
keys:
%hash = (a=>1, b=>1);
%reverse = reverse %hash; # => sometimes (1=>"b"), sometimes (1=>"a")
Hash::MoreUtil's "safe_reverse" allows you to specify a coderef that can
decide whether to ignore overwriting, croak, or whatever else.
Slicing (creating subset)
Hash::MoreUtils's "slice_*" functions.
Hash::Subset
Hash::Util::Pick
Tying
The tie mechanism, although relatively slow, allows you to create
lib/Acme/CPANModules/HashUtilities.pm view on Meta::CPAN
%hash = (a=>1, b=>2);
%reverse = reverse %hash; # => (2=>"b", 1=>"a")
Since the new keys can contain duplicates, this can "destroy" some old keys:
%hash = (a=>1, b=>1);
%reverse = reverse %hash; # => sometimes (1=>"b"), sometimes (1=>"a")
<pm:Hash::MoreUtil>'s `safe_reverse` allows you to specify a coderef that can
decide whether to ignore overwriting, croak, or whatever else.
## Slicing (creating subset)
<pm:Hash::MoreUtils>'s `slice_*` functions.
<pm:Hash::Subset>
<pm:Hash::Util::Pick>
lib/Acme/CPANModules/HashUtilities.pm view on Meta::CPAN
%hash = (a=>1, b=>2);
%reverse = reverse %hash; # => (2=>"b", 1=>"a")
Since the new keys can contain duplicates, this can "destroy" some old keys:
%hash = (a=>1, b=>1);
%reverse = reverse %hash; # => sometimes (1=>"b"), sometimes (1=>"a")
L<Hash::MoreUtil>'s C<safe_reverse> allows you to specify a coderef that can
decide whether to ignore overwriting, croak, or whatever else.
=head2 Slicing (creating subset)
L<Hash::MoreUtils>'s C<slice_*> functions.
L<Hash::Subset>
L<Hash::Util::Pick>
=head2 Tying
( run in 0.687 second using v1.01-cache-2.11-cpan-de7293f3b23 )