in reply to Techniques On Saving Memory
You could even make a class implementing hashes of fixed-size arrays and give it an indexing method. I'm not going to. :-)use strict; use warnings; my %hash; my @array; my $row_length = 5; my $next_available = 0; for (qw(cow pig donkey)) { $hash{$_} = $next_available; for my $col (0..($row_length - 1)) { $array[$next_available + $col] = "$_ $col"; } $next_available += $row_length; } # What would have been $hash{pig}[3]: print $array[$hash{pig}+3];
|
|---|