in reply to sequential file handling
Here's how to do just the 'round robin' part.
The % operator gives you the remainder of the division of $counter / $num_targets, which will be 0, 1 or 2 for any value of $counter. Use that number to select the proper directory out of the array.my @dirs = qw{ dir1 dir2 dir3 }; my $num_targets = $#dirs + 1; my $counter = 0; foreach (0..10) { my $target = $dirs[$counter % $num_targets]; print "$_ => $target\n"; $counter++; }
Run this little snippet and you can see the result...
In Section
Seekers of Perl Wisdom