use warnings; use strict; open my $wfh, ">>", "output_cal_date.txt" or die "$0: open : $!"; my $currenttime = localtime(); print $wfh "Current Time : $currenttime\n\n"; # prints to file print "this prints to STDOUT"; print ("Enter the FROM date in dd/mm/yyyy format : \n"); my $from_date_1 = ; chomp($from_date_1); print $wfh $from_date_1; close $wfh;