How to write to file in Perl ?

Question

How to write to file in Perl ?

Re: How to write to file in Perl ?

irst initiate file handler , than just use open function
$out="c:/scripts/out.txt";
open OUT, ">$out" or die "Cannot open $out for write :$!";
for $i (1..10) {
print OUT "$i : The time is now : ",scalar(localtime),"\n";
}