in reply to Re^2: Array of arrays
in thread Array of arrays
So that leaves what's happening with each @row inside the loop.my @row; while ( @row = $sth_C->fetchrow_array ) { undef @row; }
Here (above), I'm constructing a single string to represent the contents of the entire row. It's fairly expensive, in the sense that the contents of the entire row are duplicated. So if the row contains a kilobyte of data, $krow will too.my $krow = join "\0", @row;
Here, I'm attempting to access an element of the hash using the key string I generated. The value of such an element is going to be interpreted as a number, because ++ only works on numbers. (Actually that's not quite true; but the exception doesn't concern us now.)$seen{$krow}++ and next;
Finally, print out a line for this row. So, in effect, only print out this exact list of data the first time it's encountered in the query results.print OUTPUT_FILE join( "\t", @row ), "\n";
|
|---|