open(DUMP,">>./dump.txt") or die "could not open: $!\n"; open(ERR,">>./error.txt") or die "could not open: $!\n"; while ($DIR[$a]) { print "$directory\\$DIR[$a]\n"; print DUMP "$directory\\$DIR[$a]"; my $output = `identify -verbose $directory\\$DIR[$a]`; or print ERR "$directory\\$DIR[$a]\n"; print DUMP "$output\n"; $a=$a+1; }