in reply to stdout/err redirection

There may well be a more elegant way to do this than mine, but if your using Unix/Linux, you may have some success with the tee command. Something along these lines:

#! /usr/bin/perl use strict ; use warnings ; $|++ ; my $logfile = 'my_log.txt' ; open STDOUT, "| tee $logfile" ; open STDERR, ">&STDOUT" ; print STDOUT "I'm going to standard output.\n" ; print STDERR "I'm going to standard error.\n" ;

Both messages go to the console, and to the log file.


_______________
D a m n D i r t y A p e
Home Node | Email