listmail wrote:
Well I'm not seeing why a number of arrays that each point to arrays
could not be consider a matrix of arrays when considering one definition
of the word matrix "Something resembling such an array, as in the
regular formation of elements into columns and rows". I dunno, i'm not
Because the data type of "$results" is an array reference.
Each item in it is also an array refenerence, so instead of confusing
and overwhelming your self with complex and ominous sounding "matrix"
Just think:
Ok, $results contains all of my $records, each $record has all of the
columns I SELECTed.
very simple and intuitive and doesn't sounds like you have to be
einstein or neo to understand and manipulate it.
trying to argue with you of course. It is apparent that I truly am
confused with Perl References again. I beleive my main mistake could be
because you're making it too hard on yourself thinking in such abstract
apocolyptic terms such as "matrix" which relate to computing theory in
general instead of a well defined paradigm and implimentation of a
specific component of the given language.
Sure *technically* and array ref that contains other array refs can be
considered a matrix but "an array ref of array refs" not only tells you
what it is but *exactly* what each part of it is which in turn instantly
tells you how it needs to be accessed which ultimately makes the 50 or
60 line script you sent originally about 10 lines or less. (IE by using
the array of array setup instead of some convoluted matrix that is
structured god know how.
That means in six months when you (or heaven forbid me) have to maintain
your code we don't have to figure what you were smoking to get what you
were after and what you personally define as a matrix and how you'd
structure and access the data in said matrix, etc etc
using "foreach my $record (@{ $results })" instead of what you've shown
"for my $record (@{ $results })". I'll test this later when I get a
for and foreach are the same thing, foreach just takes up 4 more
characters so I always use for(), its cleaner IMHO but do what you like :)