open(OLDERR, ">&STDERR"); open(STDERR, ">>/tmp/tmp.spderr") or die "Can't dup stdout"; select(STDOUT); $| = 1; # make unbuffered print OLDERR ""; #this fixed an error about OLDERR not being used ## do my stuff here. close(STDERR); open(STDERR, ">&OLDERR");