Perl & MySQL question

Mike Starke mgcon@neta.com
Sun, 9 Jul 2000 20:09:52 -0700 (MST)


I have something like the following in a script:

$sql = qq{SELECT col1, col2 FROM table};
$sth = $dbh->prepare($sql);
$sth->execute;
while (my $data = $sth->fetchrow_hashref) {
   do stuff
}
another while loop

I need to take the values from the query and create
two arrays: @array1 = values in col1, @array2 = values in col2
after this, I then create a third array
@array3 = ([@array1], [@array2]);

I have been brute forcing this by making two calls,
one while loop for col1, and then turn around and another
while loop for col2. I know the Perl way is there is more than one
way to do things, but certainlly there is a better way.
As you can see by the question, I am no Perl expert, but
anyone willing to lend a hand?

Mike
mgcon@getnet.com
http://www.getnet.com/~mgcon
Phoenix, AZ
USA