kapoor has asked for the wisdom of the Perl Monks concerning the following question:

David, After making changes as per your recommendation, my result started displaying:

HASH(0x8d9f80) HASH(0x8d9fb0) HASH(0x8d9fe0) HASH(0x8da010) HASH(0x8da040) HASH(0x8da070) HASH(0x8da0a0) HASH(0x8da0d0) HASH(0x8da100)
before it was displaying:
ARRAY(0x6fa930)
now it is displaying a hash. To elaborate I am trying to get data back from database it's a simple query which returns mysql> select count(*) from bugs where product_id = 19 and component_i +d = 271 and bug_status='RESOLVED'; +----------+ | count(*) | +----------+ | 2957 | +----------+

Please assist. thanks!!!

Replies are listed 'Best First'.
Re: Query database
by Corion (Patriarch) on Mar 18, 2010 at 21:53 UTC
Re: Query database
by ~~David~~ (Hermit) on Mar 18, 2010 at 22:01 UTC
    Your $sth->fetchall_arrayref({}); returns a reference to an array.
    Instead of doing print $results; you should do something like so:
    foreach my $result ( @{$results} ){ print $result, '<BR>'; }
    ~~David~~

      David, After making changes as per your recommendation, my result started displaying:

      HASH(0x8d9f80) HASH(0x8d9fb0) HASH(0x8d9fe0) HASH(0x8da010) HASH(0x8da040) HASH(0x8da070) HASH(0x8da0a0) HASH(0x8da0d0) HASH(0x8da100)
      before it was displaying:
      ARRAY(0x6fa930)
      now it is displaying a hash. To elaborate I am trying to get data back from database it's a simple query which returns mysql> select count(*) from bugs where product_id = 19 and component_i +d = 271 and bug_status='RESOLVED'; +----------+ | count(*) | +----------+ | 2957 | +----------+

      Please assist. thanks!!!

Re: Query database
by desemondo (Hermit) on Mar 19, 2010 at 02:39 UTC
    I don't understand what could be the problem
    In this particular case it wouldn't have helped, but in many many others, use strict (which you have commented out) will complain about such things, and save you a lot of time and frustration.