Dan Linder wrote:
I thought of that but I couldn't find an comments regarding the differences caused by changing the hash (%fields) to a straight variable ($fields). I know Perl doesn't do strict casting of variables, but this still looked odd to me.
-ponder- When you eval this
$fields = {
'FIELD1' => {
FIRSTNAME => 'Joe',
LASTNAME => 'Smith'
}
$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'ing.
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.
You might want to stick these in the top of your program: use strict; use warnings; use diagnostics; Those should help you see typos in your code... HTH, j (I still think eval is evil and you should use Storable. $0.02 -grin-)