in reply to General Solution: initializing multidimensional arrays

How would you do it?
Since you asked, my answer is "I don't".

I've written a lot of Perl code over the many years. Rarely have I needed to "initialize" anything. Maybe it's the class of problems I solve, but I generally just let autoviv take care of fleshing out my arrays and hashes as I need them.

Letting undef stand in for either an empty string or the zero value is amazingly handy.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on Re: General Solution: initializing multidimensional arrays

Replies are listed 'Best First'.
Re^2: General Solution: initializing multidimensional arrays
by Roy Johnson (Monsignor) on Jun 01, 2005 at 15:20 UTC
    Bit of a "forest/trees" issue. Initialization is not the goal, it is merely a scenario. The goal is to iterate over an n-dimensional (sub-)array. And preferably with Algorithm::Loops NestedLoops. For a more palatable scenario, say I wanted A::L NL to give me an iterator.

    Caution: Contents may have been coded under pressure.