in reply to Redirecting STDOUT to file and screen as an afterthought, on Windows.
-HTHuse FileHandle; my $log = 0; print "Do you want to log to a file?"; my $resp = <STDIN>; if ($resp =~ /^y/i) { my $fh = new FileHandle; my $filepath = "c:\\stdout.txt"; $fh->open(">> $filepath") || die "could not open log file $filepat +h"; select $fh; } # # this will go to log file if $resp was y # print "Holla!\n";
|
|---|