steelrose has asked for the wisdom of the Perl Monks concerning the following question:
Greetings Wise Monks:
I have a program that in part uses a database object to query a database and return it's contents in a table to the originating program.
The problem I'm having is that I then want to loop through all of the rows in that table, which of course can vary. The code I was attempting to use causes a "Can't use string ("2") as an ARRAY ref while "strict refs" in use at..." error.
2 is of course, the correct number of rows in my test scenario. What I'm not grasping is why if perl knows the value, is it not able to insert it into the variable?
Any suggestions are helpful.
The problem I'm having is that I then want to loop through all of the rows in that table, which of course can vary. The code I was attempting to use causes a "Can't use string ("2") as an ARRAY ref while "strict refs" in use at..." error.
2 is of course, the correct number of rows in my test scenario. What I'm not grasping is why if perl knows the value, is it not able to insert it into the variable?
Any suggestions are helpful.
my $Table = $dbObject->getTable; my $tableDimensions = @$Table; my $numRows = $tableDimensions->[0]; #the error occurs here for (my $timesThru=0; $timesThru<=$numRows; $timesThru++) {
If you give a man a fish he will eat for a day.
If you teach a man to fish he will buy an ugly hat.
If you talk about fish to a starving man, you're a consultant.
If you teach a man to fish he will buy an ugly hat.
If you talk about fish to a starving man, you're a consultant.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Getting table dimensions
by trammell (Priest) on Jun 20, 2005 at 14:18 UTC | |
by steelrose (Scribe) on Jun 20, 2005 at 14:20 UTC | |
Re: Getting table dimensions
by jasonk (Parson) on Jun 20, 2005 at 14:20 UTC | |
Re: Getting table dimensions
by dragonchild (Archbishop) on Jun 20, 2005 at 13:36 UTC | |
by steelrose (Scribe) on Jun 20, 2005 at 13:59 UTC | |
Re: Getting table dimensions
by aukjan (Friar) on Jun 20, 2005 at 13:39 UTC |
Back to
Seekers of Perl Wisdom