It is doing this because your
system command is returning 0 (good in Windows but translated as false by Perl) if the command is sucessful and you are not capturing this value. if you do
$garbage = system(blah) or "handle error" ; this will return true and things will work like you expect.
The problem with that is that you will need to evaluate
$garbage for a 0 value or die. So:
$garbage = system("identify -verbose $directory\\$DIR[$a] >> c:\\dump.
+txt");
if ($garbage != 0){ system("echo ERROR: $directory\\$DIR[$a] >> c:\\er
+ror.txt") ;}
Also
grep's solution is a much better way to go for logging. Cleaner, quicker and not reliant on
system() commands.
"Nothing is sure but death and taxes" I say combine the two and its death to all taxes!