use IO::Scalar; my $capture; tie(*CAPTURE, 'IO::Scalar', \$capture); select (CAPTURE);