# do this once (obviously, I hope) use IO::File; open LOG, ">>log.out" or die "opening log.out: $!\n"; LOG->autoflush(1); printf LOG "PROC $$: %d %s run starts %s\n", time, __FILE__, scalar(localtime); # put lots of these throughout your program printf LOG "PROC $$: %d %s(%d)\n", time, __FILE__, __LINE__;