foreach my $stat (readdir ISSUE) { next if $stat =~ m/^0\./; # ignore 0.tiff et cetera next if $stat =~ m/^\.\.?/; # ignore current and parent directory next unless defined $stat; warn "$stat\n" if $debug; if ($stat =~ m/tiffcheck/) { # line 50 open TIFF, "$logdir/$issue/$stat" or die "could not open $logdir/$issue/$stat: $!\n"; foreach my $line () { next if $line =~ m/Starting/; next unless defined $line; if (($line =~ m/Completed/) and !$tiffcheck) { $tiffcheck = (split / /, $line)[2]; } else { $tiffcheck = "E"; } } close TIFF or warn "error closing $logdir/$issue/$stat: $!\n"; }