in reply to how do i redirect STDOUT, STDIN, or STDERR to a FILE?
unfortunately, it dosen't seem to work :(if ($opt_f eq '') { print "Please enter the OUTPUT filename [defaults to screen]: "; $output_filename = <STDIN>; chomp($output_filename); if ($output_filename eq '') { } else { open(SAVOUT, ">&STDOUT"); # save the stdout fhandle open(STDOUT,">" . $output_filename); select(STDOUT); # force a flush on stdout so that any output +will be in sync. $| = 1; } } elsif ($opt_f ne "DEFAULT") { $output_filename = $opt_f; }
Originally posted as a Categorized Answer.
|
|---|