http://qs321.pair.com?node_id=1161958


in reply to Creating pointers in a HoH declaration

I'm afraid I don't see any compelling reason to do this sort of thing in a single initialization step. You're just doing an initialization; you already know, in advance of writing the code, that you need multiple hash keys that point to the same data, and I gather you've already established that the "normal" way of doing this does what you intend, so it would seem clearer, cleaner, and more maintainable to be explicit about how the initialization is done:
my %fields = ( version1 => { 1 => 'Field 1', 2 => 'Field 2', 3 => 'Field 3', }, version2 => { 1 => 'Field 1', 2 => 'Field 2', 3 => 'Field 3', 4 => 'Field 4', }, version3 => { 1 => 'Field 1', 2 => 'Field 2', 3 => 'Field 3', 4 => 'Field 4', 5 => 'Field 5', }, ); my %synonyms = ( version4 => 'version3', # ... maybe you want others? ... ); $fields{$_} = $fields{ $synonyms{$_} } for ( keys %synonyms );