Although, as much as I hate to remind it, my first suggestion would be to 'use strict' in your code. I've tried running your script with 'use strict' and it brought up a hoard of errors and warnings. I'm not, however, implying that this may be the cause of your troubles, but there's still a lot of 'unknowns' and blind spots left if you don't use the strict pragma in your code.
Update:
From the
system manpage, you may try retrieve a little bit more info on the specific error of the ImageMagic script like so:
my $sys_res = system("identify -verbose $DIR[$a] >> $dump");
if ($sys_res) {
# an error occurred!
my $exit_value = $? >> 8;
my $signal_num = $? & 127;
my $dumped_core = $? & 128;
die "system failed: $exit_value, $signal_num, $dumped_core!"
}
You also say,
The problem occurs with a few files that are bad and bring down the programme.
Do you mean the
system() call causes your actual script to terminate, not only the ImageMagic script? Please verify. Frankly, I never came across a problem where a call to the system() function would kill the parent process. Maybe that it is implemented differently on the Win 32 platform as it doesn't do 'forking' quite well or differently.
_____________________
<code>
# Under Construction
</c ode>