in reply to How do I redirect STDOUT to a string?

If your using 5.8.x, then you can use the "in-memory file" form of open.

#! perl -slw use strict; sub IO2Mem{ my( $memRef, $mode, $io ) = @_; die 'Usage: IO2Mem( scalarRef [, mode] )' unless ref $memRef eq 'SCALAR'; open $io, $mode || '>', $memRef or die $!; return select $io; } my $memory; my $saved = IO2Mem( \$memory ); print 'Hello world!' for 1 .. 10; $memory =~ s[o w][o, W]g; select $saved; print $memory; __END__ P:\test>test2 Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World!

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon