first

Evaluate regular expression or callback for each element in collection and return the first one that matched the regular expression, or for which the callback returned true. The element will be the first argument passed to the callback and is also available as $_.

my $five = $collection->first(sub { $_ == 5 });

flatten

my $new = $collection->flatten;

Flatten nested collections/arrays recursively and create a new collection with all elements.

grep

Evaluate regular expression or callback for each element in collection and create a new collection with all elements that matched the regular expression, or for which the callback returned true. The element will be the first argument passed to the callback and is also available as $_.