open(STDOUT, ">>log.file"); #open STDOUT and direct into log.file print "test\n"; #print to STDOUT directed into log.file close STDOUT; #close the redirection to STDOUT open (LOG, "log.file"); #open log.file under a new FileHandle foreach () { print; } #loop through and print each line.