use IO::Scalar; tie *STDOUT, 'IO::Scalar', \my $output; print "foo", "bar", "baz"; warn "got - [$output]\n"; __output__ got - [foobarbaz]