use Inline::Files; open STDOUT, ">"; print "hello, world\n"; __STDOUT__ hello, world