Fascinating how most replyers misunderstood you're question, cause they read the title but not the code.
I fail to see how explanations that you can only store scalars (such as references, but not hashes) in an array imply a misunderstanding of the questions asked in the OP, which, for reference, are: "
I'd like to know how to do that without using references?" and "
How can I do the same code the same thing without using references?"
You need to write %rec=() because you don't want references.
...and that still won't work, because the code ultimately does a
push @AoH, $rec; Changing
$rec to
%rec will just plain not work because, even without
strict,
$rec and
%rec are two different variables with no direct connection between them, so it would just be pushing an
undef into
@AoH.
Of course, that could easily be fixed by changing the push to push @AoH, %rec;, which will work... but it will do something completely different than what the OP wants, as explained in b4swine's answer.
Guess you misunderstood the question because you started reading the code, then addressed the first problem you saw without bothering to read all the code.
The answer to the question actually asked, as previous posters have correctly understood, is "You can't do that without using references."