in reply to create hash names dynamically
You access the hashes, let's say the second hash with a key called 'key', like this:my @a = (1, 2, 3, 4); my @hashes; for my $num (@a) { push @hashes,{} }
Much more elegant that creating dynamic variables.$hashes[1]{key} = 'some value'; print "$hashes[1]{key}\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: create hash names dynamically
by cool (Scribe) on Jun 11, 2007 at 11:46 UTC | |
by citromatik (Curate) on Jun 11, 2007 at 12:33 UTC | |
by Util (Priest) on Jun 11, 2007 at 12:49 UTC | |
by cdarke (Prior) on Jun 11, 2007 at 13:57 UTC |