<div dir="ltr">Dan Linder wrote:<br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

I thought of that but I couldn&#39;t find an comments regarding the differences<br>
caused by changing the hash (%fields) to a straight variable ($fields). &nbsp;I<br>
know Perl doesn&#39;t do strict casting of variables, but this still looked odd<br>
to me.<br></blockquote></div></blockquote><div><br>On Thu, Aug 7, 2008 at 9:50 AM, Jay Hannah <span dir="ltr">&lt;<a href="mailto:jay@jays.net">jay@jays.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
-ponder- &nbsp; When you eval this</blockquote></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">$fields = {<br>
&nbsp;&#39;FIELD1&#39; =&gt; {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FIRSTNAME =&gt; &#39;Joe&#39;,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LASTNAME =&gt; &#39;Smith&#39;<br>
&nbsp;}<br>
<br></div>
$fields is a hash reference. But in your first post you were scoping and returning %fields, which is a hash. Hence your version was scoping and returning a hash which had absolutely nothing to do with what your were eval&#39;ing.<br>

<br>
My change was scoping a scalar $fields, which the eval turns into a hash reference, and returns that. I assume this is what you meant to do.</blockquote><div><br>The code I&#39;m working on has had an unknown number of programmers over the last five years (most field engineers who hacked the code and submitted an enhancment, not necessiaraly any full-time programmers) so some of the code in it was probably put in and left there because it worked at the time and the permissiveness of Perl allowed for the abuse of variable type casting.&nbsp; :-)<br>
<br>I need to gather a few more customer generated files to test, but I think changing to the scalar $fields is probably the correct answer.<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You might want to stick these in the top of your program:<br>
use strict;<br>
use warnings;<br>
use diagnostics;</blockquote><div>&nbsp;<br>Yes, wonderful additions - unfortunatly I know that Perl will not execute this piece of code due to failures the &quot;use strict&quot; finds so working through them is probably the best solution.&nbsp; (And if not, I can always wrapper portions of code I can&#39;t fix with &quot;no use strict&quot;...sigh)<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">(I still think eval is evil and you should use Storable. $0.02 -grin-)</blockquote>
<div><br></div></div>Hmmm, this must be a pretty evil program by your measure - it uses eval quite a bit. :-)<br><br>Storable looks like a good solution, but the saved files need to be human readable like the Data::Dump output - I searched for a flag in the Storable perldoc but couldn&#39;t find one.&nbsp;&nbsp; (And I don&#39;t think that is the intention of Storable anyway - just provide the ability to store a MACHINE readable variable not HUMAN readable...)<br>
<br>Dan<br clear="all"><br>-- <br>&quot;Quis custodiet ipsos custodes?&quot; (Who can watch the watchmen?) -- from the Satires of Juvenal<br>&quot;I do not fear computers, I fear the lack of them.&quot; -- Isaac Asimov (Author)<br>
** *** ***** ******* *********** *************<br>
</div>