Getting file size before closing the file



G'day all,
I receive numerous web files that I archive:
#..........code snippet
# .........$count increments, $tmp contains the data

my $name_of _file = $expenses."_".$count ;
print "name_of _file: ",$name_of _file,"\n";
# save as txt
open(FH, ">$name_of _file.txt");
print FH $tmp;
close(FH);

After saving, I can find the size of a file by:
my $filesize = -s "$name_of _file.txt";

Can I determine the file size before closing it?
This would be useful because some files contain
no useful data and there is no point retaining them
so for example if file size is <21000 probably no data present
so don't keep, just move to next file.

Or can I only determine the file size after it has been closed and
is in a directory?
Any advice appreciated!


.



Relevant Pages

  • Re: Getting file size before closing the file
    ... I receive numerous web files that I archive: ... print FH $tmp; ... After saving, I can find the size of a file by: ... no useful data and there is no point retaining them ...
    (comp.lang.perl.misc)
  • Re: Getting file size before closing the file
    ... I receive numerous web files that I archive: ... print FH $tmp; ... After saving, I can find the size of a file by: ... no useful data and there is no point retaining them ...
    (comp.lang.perl.misc)