in reply to Re^2: Implementing a cyclic array
in thread Implementing a cyclic array
While many of the other solutions are perhaps a closer fit to your problem, I thought that I would show you a solution that is closer to the code that you tried:
use strict; use warnings; my @array_1 = ("tom","harry","diana","nick","sally","henry"); my @array_2 = ("play()","eat()","sleep()"); foreach (@array_1) { my $action = shift(@array_2); print "$action maps to $_\n"; push(@array_2, $action); } which prints play() maps to tom eat() maps to harry sleep() maps to diana play() maps to nick eat() maps to sally sleep() maps to henry
In Section
Seekers of Perl Wisdom