NAME
Util::Medley::List - utility methods for working with lists
VERSION
version 0.062
SYNOPSIS
%map
=
$util
->listToMap(
@list
);
%map
=
$util
->listToMap(
list
=> \
@list
);
$min
=
$util
->min(
@list
);
$min
=
$util
->min(
list
=> \
@list
);
$max
=
$util
->max(
@list
);
$max
=
$util
->max(
list
=> \
@list
);
@list
=
$util
->undefsToStrings(
@list
);
@list
=
$util
->undefsToStrings(
list
=> \
@list
);
@uniq
=
$util
->uniq
@list
);
@uniq
=
$util
->uniq(
list
=> \
@list
);
DESCRIPTION
...
METHODS
contains
Search for pattern in a list.
Returns bool
- usage:
-
$bool
=
$util
->contains(\
@list
,
'mystring'
);
$bool
=
$util
->contains(\
@list
,
undef
);
$bool
=
$util
->contains(\
@list
,
qr/myregex/
);
$bool
=
$util
->contains(
list
=> \
@list
,
match
=>
'mystring'
);
$bool
=
$util
->contains(
list
=> \
@list
,
match
=>
undef
);
$bool
=
$util
->contains(
list
=> \
@list
,
match
=>
qr/myregex/
);;
- args:
diff
Returns an array of elements that are found in list1 or list2, but not both.
Wrapper around List::Compare::get_symmetric_difference().
- usage:
-
@diff
=
$util
->diff(\
@list1
, \
@list2
,
$sort
);
@diff
=
$util
->diff(
list1
=> \
@list1
,
list2
=> \
@list2
,
sort
=>
$sort
);
- args:
differ
Compares two arrays and returns true if they differ or false if not.
- usage:
-
$bool
=
$util
->differ(\
@list1
, \
@list2
,
$sort
);
$bool
=
$util
->diff(
list1
=> \
@list1
,
list2
=> \
@list2
,
sort
=>
$sort
);
- args:
isArray
Checks if the scalar value passed in is an array.
listToMap
min
Just a passthrough to List::Util::min()
max
Just a passthrough to List::Util::max()
nsort
Sort an array naturally (case in-sensitive). This behaves the same way Sort::Naturally::nsort does with the exception of using fc (casefolding) instead of lc (lowercase). This guarantees the same results without regard to locale (which Sort::Naturally::nsort does use).
shuffle
Just a passthrough to List::Util::shuffle()
undefsToStrings
- usage:
-
%map
=
$util
->undefsToStrings(
$list
, [
$string
]);
%map
=
$util
->undefsToStrings(
list
=> \
@list
, [
string
=>
$str
]);
- args:
uniq
Just a proxy to List::Util::uniq().