perlancar > Array-Find-0.08 > Array::Find

Download:
Array-Find-0.08.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.08   Source  

NAME ^

Array::Find - Find items in array, with several options

VERSION ^

This document describes version 0.08 of Array::Find (from Perl distribution Array-Find), released on 2015-09-03.

SYNOPSIS ^

 use Array::Find qw(find_in_array);
 use Data::Dump;

 dd find_in_array(
     items      => [qw/a x/],
     array      => [qw/a b d a y x/],
     max_result => 2,
 ); # ['a', 'a']

 # return unique results
 dd find_in_array(
     items      => [qw/a x/],
     array      => [qw/a b d a y x/],
     max_result => 2,
     unique     => 1,
 ); # ['a', 'x']

 # find by prefix (or suffix, with/without word separator), in multiple arrays
 dd find_in_array(
     item       => 'a.b',
     mode       => 'prefix',
     word_sep   => '.',
     arrays     => [
         [qw/a a.b. a.b a.bb/],
         [qw/a.b.c b.c.d/],
     ],
 ); # ['a.b.', 'a.b', 'a.b.c']

DESCRIPTION ^

This module provides one subroutine: find_in_array to find items in array.

FUNCTIONS ^

find_in_array(%args) -> any

Find items in array, with several options.

find_in_array looks for one or more items in one or more arrays and return an array containing all or some results (empty arrayref if no results found). You can specify several options, like maximum number of results, maximum number of comparisons, searching by suffix/prefix, case sensitivity, etc. Consult the list of arguments for more details.

Currently, items are compared using the Perl's eq operator, meaning they only work with scalars and compare things asciibetically.

Arguments ('*' denotes required arguments):

Return value: (any)

SEE ALSO ^

List::Util, List::MoreUtils

HOMEPAGE ^

Please visit the project's homepage at https://metacpan.org/release/Array-Find.

SOURCE ^

Source repository is at https://github.com/perlancar/perl-Array-Find.

BUGS ^

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

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.

AUTHOR ^

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE ^

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

syntax highlighting: