in reply to how to give size to a file at the time of creation

If you want to have log files for different dates, you could make the date part of the filename:

use strict; use warnings; my @date = localtime(time); my $filename = sprintf( "/home/abc/filename_%d_%02d_%02d.txt", $date[5 +]+1900, $date[4]+1, $date[3] ); print "$filename\n";