RE: anyway to determine # rows before fetch loop ends and without seperate count(*)





listmail [mailto:listmail@xxxxxxxxxxxx] 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
> 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
> using "foreach my $record (@{ $results })" instead of what you've shown
> "for my $record (@{ $results })". I'll test this later when I get a
> chance and also see how I can include the use of bind variables while
> using this method as well.
>

You can certainly call it a matrix if you want to, but other people may not
know what you mean. (I didn't, when I read your original post.) The
standard Perl terminology is to call it an array of arrays.

foreach and for in Perl are completely interchangeable.

These two are the same:
foreach my $x (@list)
for my $x (@list)

These two are also the same:
for (my $i = 0; $i < 10; ++$i) {
foreach (my $i = 0; $i < 10; ++$i) {

Which you use is merely style/personal preference.


Ronald


.



Relevant Pages

  • Re: Idiom for array index that Im foreaching over?
    ... >>you'll find that you rarely want to loop over an index. ... With hashes, indexed access, and hence loops ... > simplicity and elegance that I expect out of good modern Perl ... If, for some reason, the data is given in individual arrays, there are ...
    (comp.lang.perl.misc)
  • Re: Fw: question
    ... As a matter of fact Perl has: ... With the above functions and arrays and hashes there are very few data ... Also, PHP is a very different language then Perl, remember that. ... What happens if I add or remove keys from a hash while iterating over it? ...
    (perl.beginners)
  • Re: delimited data into nested array
    ... > Perl as a two dimensional nested array. ... Do you have a good reason for reading the file into an array ... If you'd still like to use the arrays, read up on perllol and use this: ... This whole loop was condensed above by using join, $\, and that handy ...
    (comp.lang.perl.misc)
  • Re: SET Operations in Perl
    ... Those are good if you have sets in arrays. ... But if you have to store sets in Perl then arrays are not the natural type. ... Some what one usually thinks of as the primative set operations are not ... primative in this implementation but the primatives you do have are ...
    (comp.lang.perl.misc)
  • Re: math operations
    ... I just want to know if I can do the following things with perl: ... However, from the series of articles you've been posting lately, it ... helping people to help you, you don't have clear ideas about ... "arrays with their elements being bits". ...
    (comp.lang.perl.misc)