I've used IO::Scalar in cgi scripts on apache before, and your code looked pretty similar to mine, so I thought I'd see what was different. In my code I never did anything with the return value from tie, and I think that's what's breaking for you. It's the "close $SH" line that's the problem. I tried the following script on my apache, and did not see any output:
print "Content-type: text/html\n\n";
my $SH = tie *STDOUT,'IO::Scalar', \$output;
$result = "output: $output";
Then I commented out the "close" line, and it worked! I'm not sure why -- I would have expected to at least see "output:" no matter what.