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; }