in reply to Help with complex data structures
1. Is is safe to use a variable variable name for the hash (%$uid)?
No, don't do this. See Why it's stupid to `use a variable as a variable name' for detailed explanation (Dominus writes better than I do ;--)
3. Would you do it another way?
Use a hash of hashes, the uid being the key in the first hash:
# store the values $files{$uid}={ name => $name, size => $size, age => $age}; # use them, print uid/name foreach my $uid (keys %files) { print "$uid: $files{$uid}->{name}\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Help with complex data structures
by tommyw (Hermit) on Nov 14, 2002 at 15:42 UTC | |
by neilwatson (Priest) on Nov 14, 2002 at 16:33 UTC |