I want to assign a value to an annonymous hash:
$hash->[$i][$j]{Score} = 1;
This implies $hash is a
reference to an array containing
references to arrays containing
references to hashes,
i.e., that the structure you want is
$hash = [
($i - 1 elements),
[
($j - 1 elements),
{
Score => 1
}
]
];
Why won't it accept a scalar? I get an error about perl expecting an
address to an array. What I envisioned was a hash within a 2D array.
I ended up using this:
$hash->[$i]{$j}{Score} = 1;
....which implies that the structure you actually have is
$hash = [
($i - 1 elements),
{
$j => {
Score => 1
}
}
];
.. The error about 'reference to an array' is referring to the contents
of $hash->[$i]: by attempting to dereference it with [$j] you are
assuming it contains an arrayref, when it seems as though it in fact
contains a hashref.
and it does what I want it to - just curious.
I don't think it does. For a start, the elements of $hash->[$i] are
ordered in the structure you (thought you) wanted, whereas here they
are not.
I think you have misunderstood either your data structure or how
references work in Perl. Add 'use Data:

umper;' to the top of your
script and 'print Dumper $hash;' just before this line. Then carefully
re-read perllol and perlreftut again, and compare with what you see.
If you still don't understand, then explain carefully what you are
trying to achieve with this data structure and show the code you have
at present, and someone will be better placed to tell you which one
you meant and what is wrong with your code.
Ben