Hash::Subset - Produce subset of a hash
This document describes version 0.001 of Hash::Subset (from Perl distribution Hash-Subset), released on 2019-07-10.
use Hash::Subset qw(hash_subset hashref_subset); # using keys specified from an array my %h = hash_subset ({a=>1, b=>2, c=>3}, ['b','c','d']); # => (b=>2, c=>3) my $h = hashref_subset({a=>1, b=>2, c=>3}, ['b','c','d']); # => {b=>2, c=>3} # using keys specified from another hash my %h = hash_subset ({a=>1, b=>2, c=>3}, {b=>20, c=>30, d=>40}); # => (b=>2, c=>3) my $h = hashref_subset({a=>1, b=>2, c=>3}, {b=>20, c=>30, d=>40}); # => {b=>2, c=>3}
None exported by default.
Usage:
my %hash = hash_subset (\%hash, \@keys); my $hashref = hashref_subset(\%hash, \@keys); my %hash = hash_subset (\%hash, \%another_hash); my $hashref = hashref_subset(\%hash, \%another_hash);
Produce subset of %hash, returning the subset hash (or hashref, in the case of hashref_subset function).
%hash
hashref_subset
See "hash_subset".
Please visit the project's homepage at https://metacpan.org/release/Hash-Subset.
Source repository is at https://github.com/perlancar/perl-Hash-Subset.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Hash-Subset
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Some other hash utilities: Hash::MostUtils
perlancar <perlancar@cpan.org>
This software is copyright (c) 2019 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Hash::Subset, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Hash::Subset
CPAN shell
perl -MCPAN -e shell install Hash::Subset
For more information on module installation, please visit the detailed CPAN module installation guide.