in reply to hash, a troublemaker?
Instead of hashes for the entities, and attributes as the keys, make hashes for the attributes, using the entities as attributes - just make sure the entities are unique.my (%person1, %person2, %person3, ...); $person1 {name} = "..."; $person1 {age} = ...; $person2 {name} = "..."; $person2 {aeg} = ...; # Oopsie. $person3 {name} = "..."; $person3 {age} = ...;
my (%age, %name); my $entitie_count = 0; my $person1 = ++ $entitie_count; my $person2 = ++ $entitie_count; my $person3 = ++ $entitie_count; $name {$person1} = "..."; $age {$person1} = ...; $name {$person2} = "..."; $aeg {$person2} = ...; # Compile time error with use strict. $name {$person3} = "..."; $age {$person3} = ...;
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: hash, a troublemaker?
by flyingmoose (Priest) on May 12, 2004 at 14:11 UTC | |
by Abigail-II (Bishop) on May 12, 2004 at 14:17 UTC | |
by flyingmoose (Priest) on May 12, 2004 at 14:26 UTC | |
by Doraemon (Beadle) on May 12, 2004 at 14:35 UTC |