The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

List::Enumerate - Provides list enumeration

VERSION

version 0.005

SYNOPSIS

Provides a simple means of list enumeration.

my @list = qw(Larry Moe Curly);

for my $name ( enumerate(@list) ) {
  print $name->index, " ", $name->item, "\n";
}

Instead of

my @list = qw(Larry Moe Curly);

my $index = 0;
for my $name ( @list ) {
   print $index, " ", $name, "\n";
   $index++;
}

METHODS

enumerate

Returns a list of List::Enumerate objects when called with a list

index

List::Enumerate call, returns the index position

item

List::Enumerate call, returns the item

new

Constructor for List::Enumerate, used internally

AUTHOR

James Spurin <spurin@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by James Spurin.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.