could label the day at TXT file?
Hi,
I made the perl script and I print out with Txt file.
For EX :
Open (OUTPUT,">data.txt"));
out put
data.txt
But I hope at the day that I run the script, the day will be labeled with the name file. Like the name below:
20110919data.txt
Could you please show me how to solve this problem.
Thank you very much.
biojet
Junior Poster in Training
52 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
use the 'localtime' function and get the date format.
$filename='data.txt';
my ($sec,$min,$hour,$mday,$mon,$year)=localtime();
$year+=1900;
$mon=sprintf("%02d", $mon+1);
$mday=sprintf("%02d", $mday);
my $today_file = "$year$mon$mday"."$filename";
print $today_file;
Read More...
perldoc -f localtime
k_manimuthu
Junior Poster in Training
93 posts since Jun 2009
Reputation Points: 55
Solved Threads: 24
Thank you very much for your help.
I ask you small question.
how can I have the result 20110919baselist.txt if I use below code
open(BASE,">baselist.txt");
for (my $i = 0; $i < $num; $i++){
$base=substr($ref,$posi[$i]-1, 3);
print $base;
print BASE $base."\n\n";
}
close(BASE);
biojet
Junior Poster in Training
52 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0