in reply to Saving Standard Output (overloading print())
I'm sure it is much more elegant in the book... check the IPC chapter. :)#!/usr/bin/perl use strict; my $logfile = $ARGV[0]; open STDOUT, "|-" or do { open LOG, ">> $logfile" or die "Unable to open $logfile: $!\n"; while (<STDIN>) { print, print LOG } close LOG, close STDOUT; exit; }; print "This is only a test.\n";
-faure
|
|---|