in reply to Hash of anonymous hashes --- Oh my

You're clobbering %rets. You should instead do:

$rets{"$retid$fnum"} = { FNAME => $fn, RECLEN => $rl, LIAISON_EMAIL => $mle, LIAISON_FNAME => $mlfn, LIAISON_LNAME => $mlln, LIAISON_AREACODE => $mlac, LIAISON_PHONE => $mlpn, LIAISON2_EMAIL => $ml2e, LIAISON2_FNAME => $ml2fn, LIAISON2_LNAME => $ml2ln, LIAISON2_PHONE => $ml2pn, RETNAME => $retname, RETAILER_EMAIL => $rce, LIAISON2_AREACODE => $ml2ac, RETAILER2_EMAIL => $rc2e, FTPCHECK => $fc, RETID => $retid, SCRIPT_NAME => $scrname, EXECFLAG => $exec, FREQUENCY => $freq, FILE_NUMBER => $fnum };

Check out perldoc perldsc for more information.

I also noticed that you have if ($fnum eq "") { my $fnum = "_001" }. You are declaring a new $fnum that can only be seen within the scope of the if. In other words, $fnum will still be "" when you construct your anonymous hash. Perhaps instead you should replace the entire if with $fnum = "_001" if $fnum eq "";. I hope this helps you with your problem.

Replies are listed 'Best First'.
Re: Re: Hash of anonymous hashes --- Oh my
by sweetblood (Prior) on Nov 17, 2003 at 19:43 UTC
    Ok, now I see what was happening. Thanks to you and the other responding monks. I was clobbering %rets by recreating it on each record instead of just letting it be autovivified.

    When I see it done right, the problem seems so clear.

    Thanks!++