> If you've just written the file, have you closed the 
> filehandle and checked the return value?
> 
> Paul Johnson - [EMAIL PROTECTED]
> http://www.pjcj.net
>


Well, I've just learned a valuable lesson (or two), which is, after all,
what I'm on this list for :)

Just prior to the code I've already posted I have this:

<snip>
                # @unixfile was created earlier
            open $unixfile, '>', "$company.$ext" or die "Can't open
$company.$ext for dos2unix process\n";
            for (@unixfile) {
               s#\r\n#\n#;    # Replace CRLF with LF
               print $unixfile $_;  # Write the edited version back to
the file
            }
            # End dos2unix #####
            
                ***** This "close" fixed the problem *****
                close $unixfile or warn "Unable to close
$company.$ext\n";

            rename "$company.$ext", "$company.$ext.$date";

            print "Creating gzip'd archive\n";

            gzip "$company.$ext.$date"    => "$company.$ext.$date.gz",
                  BinModeIn   => 1 or do {
                     warn "Failed to gzip file: $company.$ext.$date:
$GzipError\n";
                     next DOTDONE;
            };
</snip>

I was relying on Perl closing files for me, but in this particular case,
I hadn't thought it through
well enough.

Many thanks to all for helping me get a "handle" on this!

richf
 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to