D
doormouse
Perhaps I'm going about this wrong for PERL. I'm working on something
that rolls over database results. I need to spend a long time on the
result set, so I wanted to pull the query data out, close the db
connection and parse/reconnect as necessary.
While the result set is coming out I'm storing the data in to a 2d
array. At the end of the store phase I am able to pull array length
from the Y dimension but not the X.
Here's a simulation that explains my situation
---begin code---
#this is actually a query in the real code, each return plugging in to
an individual iteration.
#the number of column and rows are both variable in scope.
$thisArray[0][0] = "test";
$thisArray[0][1] = "test";
$thisArray[0][2] = "test";
$thisArray[1][0] = "test";
$thisArray[1][1] = "test";
$thisArray[1][2] = "test";
$thisArray[2][0] = "test";
$thisArray[2][1] = "test";
$thisArray[2][2] = "test";
#Preserve the scalar
$oneSize = @thisArray;
print $oneSize;
print "\n";
#point to a single dimesion, and try to do the same
@twoArr = @thisArray[0];
$twoSize = @twoArr;
print $twoSize;
print "\n";
---end code---
$oneSize comes out correctly as 3, $twoSize always comes out as 1.
I also attempted:
---begin code---
$twosize = @thisArray[0];
print $twosize;
print "\n";
---end code---
but this just brings out ARRAY(#x#######)
I'm more of a lazy PHP wheenie, so my methods might be well off the
mark of what I should be doing. I just haven't been able to find
anyone with this exact problem after quite some googling (perhaps an
indication that I'm not heading in the right direction)
any assistance you could afford me would be greatly appreciated,
Thanks in advance,
--Mike
that rolls over database results. I need to spend a long time on the
result set, so I wanted to pull the query data out, close the db
connection and parse/reconnect as necessary.
While the result set is coming out I'm storing the data in to a 2d
array. At the end of the store phase I am able to pull array length
from the Y dimension but not the X.
Here's a simulation that explains my situation
---begin code---
#this is actually a query in the real code, each return plugging in to
an individual iteration.
#the number of column and rows are both variable in scope.
$thisArray[0][0] = "test";
$thisArray[0][1] = "test";
$thisArray[0][2] = "test";
$thisArray[1][0] = "test";
$thisArray[1][1] = "test";
$thisArray[1][2] = "test";
$thisArray[2][0] = "test";
$thisArray[2][1] = "test";
$thisArray[2][2] = "test";
#Preserve the scalar
$oneSize = @thisArray;
print $oneSize;
print "\n";
#point to a single dimesion, and try to do the same
@twoArr = @thisArray[0];
$twoSize = @twoArr;
print $twoSize;
print "\n";
---end code---
$oneSize comes out correctly as 3, $twoSize always comes out as 1.
I also attempted:
---begin code---
$twosize = @thisArray[0];
print $twosize;
print "\n";
---end code---
but this just brings out ARRAY(#x#######)
I'm more of a lazy PHP wheenie, so my methods might be well off the
mark of what I should be doing. I just haven't been able to find
anyone with this exact problem after quite some googling (perhaps an
indication that I'm not heading in the right direction)
any assistance you could afford me would be greatly appreciated,
Thanks in advance,
--Mike