#!/usr/local/bin/perl print "Content-type: text/html\n\n"; use IO::Scalar; my $output; my $SH = tie *STDOUT,'IO::Scalar', \$output; print "hey\n"; $result = "output: $output"; close $SH; untie *STDOUT; print $result;