http://qs321.pair.com?node_id=11140990


in reply to using an array in a while loop

Normally, you shouldn't need the number at all:
my @dirs = ('/path/to/dir1', '/some/other/path/to/dir2', '/dir3'); for my $dir (@dirs) { ... }

To populate the array with the names, you can use a map:

my @dirs = map { sprintf 'abc_%03d', $_ } 1 .. 100;

If you really need the array index, loop over the indices rather than the elements themselves:

for my $i (0 .. $#dirs) { my $dir = $dirs[$i]; ... }

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]