It's better to use a hash-of-hashes instead:
See also perlreftut and perldata.# set up the base hash my %hashes = (); # in the loop: my $date = $4.$3.$2; if (my $hashref = $hashes{$date}) { print "<TD class=table_font>$date - Hash exists</TD>\n"; # play with hash } else { my $hashref = {}; # create a new empty hash $hashes{$date} = $hashref; store the hashref in the main hash print "<TD class=table_font>$date - Hash doesn't exist</TD>\n"; # play with hash }
In reply to Re: Dynamically creating a hash based on a variable
by Joost
in thread Dynamically creating a hash based on a variable
by beethamd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |