tie(*CAPTURE, 'IO::Scalar', \$content); select(CAPTURE); $| = 1; do $file; select(STDOUT); untie(*CAPTURE); return $content;