In one of my scripts it would be very convenient to create and name hashes dynamically. I can go around this with creating hash of hashes, but if i'd like to stick with only one hash and it's key/values, how should i do this?
In the code below i'm trying to illustrate the idea.
my @hashNames = qw(testA testB testC); my $i = 0; foreach (@hashNames) { %{$_}{'key'} = $i; }
I'm trying to create a hashes like below with the example above
%testA = ( key => '0' );
In reply to Dynamically naming and creating hashes by mellin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |