NAME

Acme::CPANModules::RemovingElementsFromArray - List of modules to help remove elements from array

VERSION

This document describes version 0.002 of Acme::CPANModules::RemovingElementsFromArray (from Perl distribution Acme-CPANModules-RemovingElementsFromArray), released on 2023-09-30.

DESCRIPTION

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

List::Util provides uniq (as well as uniqnum, uniqint, uniqstr) to remove duplicate items from a list. There's also List::Util::Uniq providing dupe, dupenum, dupeint, and dupestr, which return the duplicates instead.

Removing overlapped items

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, Array::KeepGrepped keeps the elements that are filtered out instead those that match the grep expression. 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

List::Util::mapsplice offers mapsplice, which removes a slice of array but lets you replace each element with new elements using Perl code.

ACME::CPANMODULES ENTRIES

List::Util

Author: PEVANS

List::Util::Uniq

Author: PERLANCAR

Array::OverlapFinder

Author: PERLANCAR

Array::KeepGrepped

Author: ONEONETWO

List::Util::sglice

Author: PERLANCAR

List::Util::mapsplice

FAQ

What is an Acme::CPANModules::* module?

An Acme::CPANModules::* module, like this module, contains just a list of module names that share a common characteristics. It is a way to categorize modules and document CPAN. See Acme::CPANModules for more details.

What are ways to use this Acme::CPANModules module?

Aside from reading this Acme::CPANModules module's POD documentation, you can install all the listed modules (entries) using cpanm-cpanmodules script (from App::cpanm::cpanmodules distribution):

% cpanm-cpanmodules -n RemovingElementsFromArray

Alternatively you can use the cpanmodules CLI (from App::cpanmodules distribution):

% cpanmodules ls-entries RemovingElementsFromArray | cpanm -n

or Acme::CM::Get:

% perl -MAcme::CM::Get=RemovingElementsFromArray -E'say $_->{module} for @{ $LIST->{entries} }' | cpanm -n

or directly:

% perl -MAcme::CPANModules::RemovingElementsFromArray -E'say $_->{module} for @{ $Acme::CPANModules::RemovingElementsFromArray::LIST->{entries} }' | cpanm -n

This Acme::CPANModules module also helps lcpan produce a more meaningful result for lcpan related-mods command when it comes to finding related modules for the modules listed in this Acme::CPANModules module. See App::lcpan::Cmd::related_mods for more details on how "related modules" are found.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Acme-CPANModules-RemovingElementsFromArray.

SOURCE

Source repository is at https://github.com/perlancar/perl-Acme-CPANModules-RemovingElementsFromArray.

SEE ALSO

Somewhat related lists pertaining to list/array: Acme::CPANModules::PickingRandomItemsFromList, Acme::CPANModules::Import::RSAVAGE::ArrayAndSetOperations, Acme::CPANModules::Import::MJGARDNER::ListProcessing.

Acme::CPANModules - about the Acme::CPANModules namespace

cpanmodules - CLI tool to let you browse/view the lists

AUTHOR

perlancar <perlancar@cpan.org>

CONTRIBUTING

To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

% prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

This software is copyright (c) 2023 by perlancar <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.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Acme-CPANModules-RemovingElementsFromArray

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.