Catmandu::ArrayIterator(3pm) | User Contributed Perl Documentation | Catmandu::ArrayIterator(3pm) |
Catmandu::ArrayIterator - Convert an arrayref to an Iterable object
use Catmandu::ArrayIterator; my $it = Catmandu::ArrayIterator->new([{n => 1}, {n => 2}, {n => 3}]); $it->each( sub { my $item = $_[0]; # Very complicated routine ... }); $it->[0]; # => {n => 1} $it->first; # => {n => 1} $it->map(sub { $_[0]->{n} + 1 })->to_array; # => [2, 3, 4] $it->count # => 3
Create a new iterator object from $arrayRef.
Return all the items in the Iterator as an ARRAY ref.
For each item in the Iterator execute the callback function with the item as first argument. Returns the number of items in the Iterator.
Return the count of all the items in the Iterator.
Return the first item from the Iterator.
Catmandu::Iterable, Catmandu::Iterator
2023-03-03 | perl v5.36.0 |