use strict; use warnings; use Array::Each; my @x = qw( p e r l ); my $one = Array::Each->new( \@x ); while( my( $x, $i ) = $one->each() ) { printf "%3d: %s\n", $i, $x; } #### use strict; use warnings; my @x = qw( p e r l ); for my $index (0..$#x){ print "$index : $x[$index]\n"; }