Because this is Perl, There Is More Than One Way To Do It. Here is an array-less solution given your statement about how the folders are named:
for ( my $i = 1; $i <= 4; $i++ ) {
my $dir_name = sprintf 'abc_%03d', $i;
chdir $dir_name or die "Unable to change to $dir_name: $!";
...
chdir '..';
}
But in real life I would probably use File::Find like everyone else.
In reply to Re: using an array in a while loop
by Anonymous Monk
in thread using an array in a while loop
by perlnewbie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |