Here is my current code
while (my $row = $sth->fetchrow_arrayref) { foreach ($row){ if (! ref($row)) { next; } print @$row, "\n"; } }
The if (! ref($row)){next;} does not work. It prints out two references:DBI::db=hash(0xwhatever) and DBI::st=hash(0xwhatever)and then the information that I want.

That is the secondary question and is probably cranial-rectal insertion on my part.

My primary question is: Can I use fetchall_arrayref to return all of the rows that match my query, and then parse out the information? And if so, how?

I have a query like

"select program, day, time from TVviewingsked where name = "Frank"
I would like to have all the info in computer memory to avoid tying up the database with a fetchrow_arrayref because from what I read the DBI information says that fetchall_arrayref returns an array of array references, one reference per row.

Am I even on the right track here?

Edit: chipmunk 2001-05-15


In reply to Help with fetchall_arrayref by fmogavero

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.