use Carp 'cluck'; $SIG{__WARN__}=\&cluck; open(STDERR, "|tee -a Warnings.log") or die "Can't open STDERR to tee: $!";