Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't use string ("1049") as a HASH ref

Status
Not open for further replies.

JimJx

Technical User
Joined
Feb 16, 2001
Messages
202
Location
US
Can anyone tell me why the following section of code produces the error "Can't use string ("1049") as a HASH ref while "strict refs" in use at /usr/lib/perl5/site_perl/5.8.8/Data/Pager.pm line 30."


Thanks,
Jim

Code:
my ($row, @results); 

# store each record into @results

while($row = $db_query->fetchrow_hashref()) {

        push(@results, $row);

}
 
You are trying to iterate a hashref which is incorrect.

The solution:
Code:
my @results = $db_query->fetchrow_array();

M. Brooks
 
take a closer look at the error message:

/usr/lib/perl5/site_perl/5.8.8/Data/Pager.pm line 30

this error is coming from a module, and not the main script.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top