Acme-CPANModules-RemovingElementsFromArray
view release on metacpan or search on metacpan
lib/Acme/CPANModules/RemovingElementsFromArray.pm view on Meta::CPAN
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2023-09-30'; # DATE
our $DIST = 'Acme-CPANModules-RemovingElementsFromArray'; # DIST
our $VERSION = '0.003'; # VERSION
our $LIST = {
summary => 'List of modules to help remove elements from array',
description => <<'MARKDOWN',
Perl provides several ways to remove elements from an array. `shift` removes one
element from the beginning, `pop` removes one element from the end, and `splice`
removes a slice of array (and insert another list in its place). There's also
`grep`, which lets you filter a list with a user-supplied code. While this does
not directly modify an array, you can simply assign the new filtered values to
the array. And I might just as well mention array slice (`@ary[1,3,4]` or
`@ary[1..4]`) which allows you to pick the range of elements you want by their
indices.
In addition to the above, there are also other modules which provide some
convenience.
**Removing duplicate items**
<pm:List::Util> provides C<uniq> (as well as C<uniqnum>, C<uniqint>, C<uniqstr>)
to remove duplicate items from a list. There's also <pm:List::Util::Uniq>
providing C<dupe>, C<dupenum>, C<dupeint>, and C<dupestr>, which return the
duplicates instead.
**Removing overlapped items**
<pm:Array::OverlapFinder> lets you find overlapping items from a series of
arrays and optionally remove them.
**Variations of `grep`**
Some modules offer variations of `grep`. For example, <pm:Array::KeepGrepped>
keeps the elements that are filtered out instead those that match the grep
expression. <pm:List::Util::sglice> offers `sglice`, which removes elements that
matches user-supplied code, except that `sglice` (like `splice`) allows you to
specify a limit to the number of elements to remove.
**mapslice**
<pm:List::Util::mapsplice> offers `mapsplice`, which removes a slice of array
but lets you replace each element with new elements using Perl code.
MARKDOWN
'x.app.cpanmodules.show_entries' => 0,
};
Acme::CPANModulesUtil::Misc::populate_entries_from_module_links_in_description;
1;
# ABSTRACT: List of modules to help remove elements from array
__END__
=pod
=encoding UTF-8
=head1 NAME
Acme::CPANModules::RemovingElementsFromArray - List of modules to help remove elements from array
=head1 VERSION
This document describes version 0.003 of Acme::CPANModules::RemovingElementsFromArray (from Perl distribution Acme-CPANModules-RemovingElementsFromArray), released on 2023-09-30.
=head1 DESCRIPTION
Perl provides several ways to remove elements from an array. C<shift> removes one
element from the beginning, C<pop> removes one element from the end, and C<splice>
removes a slice of array (and insert another list in its place). There's also
C<grep>, which lets you filter a list with a user-supplied code. While this does
not directly modify an array, you can simply assign the new filtered values to
the array. And I might just as well mention array slice (C<@ary[1,3,4]> or
C<@ary[1..4]>) which allows you to pick the range of elements you want by their
indices.
In addition to the above, there are also other modules which provide some
convenience.
B<Removing duplicate items>
L<List::Util> provides C<uniq> (as well as C<uniqnum>, C<uniqint>, C<uniqstr>)
to remove duplicate items from a list. There's also L<List::Util::Uniq>
providing C<dupe>, C<dupenum>, C<dupeint>, and C<dupestr>, which return the
duplicates instead.
B<Removing overlapped items>
L<Array::OverlapFinder> lets you find overlapping items from a series of
arrays and optionally remove them.
B<< Variations of C<grep> >>
Some modules offer variations of C<grep>. For example, L<Array::KeepGrepped>
keeps the elements that are filtered out instead those that match the grep
expression. L<List::Util::sglice> offers C<sglice>, which removes elements that
matches user-supplied code, except that C<sglice> (like C<splice>) allows you to
specify a limit to the number of elements to remove.
B<mapslice>
L<List::Util::mapsplice> offers C<mapsplice>, which removes a slice of array
but lets you replace each element with new elements using Perl code.
=head1 ACME::CPANMODULES ENTRIES
=over
=item L<List::Util>
Author: L<PEVANS|https://metacpan.org/author/PEVANS>
=item L<List::Util::Uniq>
Author: L<PERLANCAR|https://metacpan.org/author/PERLANCAR>
( run in 0.935 second using v1.01-cache-2.11-cpan-3d66aa2751a )