<?xml version="1.0" encoding="windows-1252"?>
<node id="291305" title="Re: Best Way to Redirect STDERR to a Scalar" created="2003-09-13 18:44:32" updated="2005-06-08 22:30:00">
<type id="11">
note</type>
<author id="91846">
mandog</author>
<data>
<field name="doctext">
&lt;p&gt; I know you are using Perl 5.6.1 but if you were using Perl 5.8...&lt;/p&gt;

&lt;code&gt;
perldoc -f open
#(snip)
File handles can be opened to "in memory" files 
held in Perl scalars via:

open($fh, '&gt;', \$variable) or die "$!";

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, '&gt;', \$variable or die "Can't open STDOUT: $!";
&lt;/code&gt;

&lt;BR&gt;&lt;BR&gt;&lt;A HREF=mailto:dan@ltc.org&gt;email: mandog&lt;/A&gt;</field>
<field name="root_node">
291299</field>
<field name="parent_node">
291299</field>
</data>
</node>
