in reply to Expect, STDout, and formating

If you are using 5.8, then you could try reopening STDOUT to an 'in memory' file as described in perlfunc:open (Search for "in memory").

File handles can be opened to ``in memory'' files held in Perl scalars + via: open($fh, '>', \$variable) || .. Though if you try to re-open STDOUT or STDERR as an ``in memory'' file +, you have to close it first: close STDOUT; open STDOUT, '>', \$variable or die "Can't open STDOUT: $!";

I'm not certain that the Expect module would cooperate with this, but it seems likely that it would. In the above examples the output would be stored in $variable.

Remember to close/reopen STDOUT to 'con' or 'tty' depending on your OS before outputing stuff you want the user to see:)


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller