#! /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" ;