$array[$foo][$bar][$baz] = $quux if $foo >= -$size[0] and $foo < $size[0] and $bar >= -$size[1] and $bar < $size[1] and $baz >= -$size[2] and $baz < $size[2];