in reply to Comparing two approaches to nested data creation
The first thing that pops into mind is that when you say @foo = ([ [], [], [] ]) x 3;, what you are really doing is creating the same structure only once, and then copying that 2 more times. ie: the 'x' operator is copying the LHS, not re-evaluating it. The following snippet should answer your question. Note how it prints "1, 1, 1, 1" rather than "1, 2, 3, 4":
#!c:/perl/bin/perl -w $|++ use strict; my $bar; print join(', ', (++$bar) x 4), "\n";
Update:
As a different approach of how to create your @othercells array:
my @othercells = map { [[],[],[]] } 1..3; # or my @othercells; push @othercells, [[],[],[]] for 1..3;
|
|---|