<div dir="ltr"><span style="font-family: courier new,monospace;">I&#39;ve got one program that generates a hash and then uses Data::Dump to write this structure to a text file:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">printf FILE Data::Dumper-&gt;Dump(\%fields],[&#39;fields&#39;]);</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">The resulting file contains this:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">--- begin contents ---</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$fields = {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp; &#39;FIELD1&#39; =&gt; {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FIRSTNAME =&gt; &#39;Joe&#39;</span>,<br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; LASTNAME =&gt; &#39;Smith&#39;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp; }</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--- end contents ---</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Unfortunately, when I try to use &quot;eval&quot; to pull this hash variable construct into a second running process:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">--- begin contents ---</span><br style="font-family: courier new,monospace;" clear="all"><span style="font-family: courier new,monospace;">sub retrieve_fields {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my ( $file )=@_;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my %fields;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; open(FILE, $file)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; local $/;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eval &lt;FILE&gt;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return %fields;<br>}<br></span><span style="font-family: courier new,monospace;">--- end contents ---</span><br style="font-family: courier new,monospace;" clear="all">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">When I run the second program, perl dies on the &quot;eval&quot; line with this error:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Variable &quot;$fields&quot; is not imported at (eval 125)[testprog.pl:33] line 1, &lt;FILE&gt; chunk 1.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">The odd thing is if the Data::Dump file is changed to &quot;%fields = ( ... )&quot; then the &quot;eval&quot; works!?!?</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">I&#39;ve found some notes about using &quot;our&quot; and &quot;use vars qw(...)&quot;.&nbsp; Anyone else have any suggestions?</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Dan</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-- </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&quot;Quis custodiet ipsos custodes?&quot; (Who can watch the watchmen?) -- from the Satires of Juvenal</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&quot;I do not fear computers, I fear the lack of them.&quot; -- Isaac Asimov (Author)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">** *** ***** ******* *********** *************</span><br style="font-family: courier new,monospace;">
</div>