in reply to Re^2: create hash names dynamically
in thread create hash names dynamically

This code:

foreach (1..3) { push @hashes, {}; }
does the same thing (but faster and cleaner) as this code:
foreach (1..3) { my %any_name; push @hashes, \%any_name; }

At the end of the each loop in the second example, the %any_name hash would normally vanish, but because a *reference* to it is saved, the hash itself still floats in memory, with no name associated with it. Since a reference is a kind of scalar, it can be stored in the array just like any other scalar. The anonymous hash constructor, {}, allows you to avoid any %temp_hash that you did not need to refer to by name.

See also: