in reply to glob problem...

one comment on your code: to zeropad a number better use something like
my $paddednum = sprintf "%06d", $num;
than that if/elsif constructs... look into the docs for printf and sprintf in perlfunc.

cheers snowcrash