{ use Tie::Handle::StdOutAndFile; local *STDOUT; tie(*STDOUT,'Tie::Handle::StdOutAndFile','file.txt') or die "Aaah $!\n"; print "whatever"; }