in reply to File not opening, but no error report

koolgirl:

Just a minor note: You're opening & closing the output file handle repeatedly, which can be pretty slow if you must do it often. One way you could speed things up is to open the output file handle only once (if required) and close it only once at the end. Something like:

# First declare your file handle my $OUT; ... foreach ... { while ... { if ... { # Error found, so... # open the file if not open yet if (!defined $OUT) { open $OUT, '>', "$path/$file" or die "Uggabug! $!"; } # and log the error print $OUT "Yer error message\n"; } } } # finally, close it if you've opened it close($OUT) if defined $OUT;
...roboticus