Looks like you're pushing a list on to another list. In effect, appending
one to the other. @data would be the first list. The second list would be
'$x, $y'. Variables in a comma delimited fashion is the same as a list or an
array.

I usually deal with multidimensional arrays this way:

$i = 0;
while (@results = $sth->fetchrow_array ())
{
    $x = $results[0];
    $y = $results[1];
    @points = ($x, $y);
    $data[$i] = [EMAIL PROTECTED];
    $i++;
}

I think that will work... maybe :)

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, June 03, 2005 2:42 PM
To: beginners@perl.org
Subject: Two Dimensional Array Problem


I am trying to send the output of a mysql query to a two dimensional array.

This is what I've tried using push.

while (@results = $sth->fetchrow_array ())
{
    $x = $results[0];
    $y = $results[1];
    push (@data,[$x],[$y]);
}

However, I don't get back a two dimensional array, I get back a single
array of @data.

Thanks. -Aaron

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to