I've taken a look at all of the postings for this error on Perl Monks, and I still didn't get an answer to my situation. The error is understandable. What I don't understand is what I can do to fix it. The hash I'm referencing is a query to a MySQL database. I am using fetchall_hashref to get the results and create the hash. The problem is that no matter what column I use as the 'key' to the hash, none of the values in the database are anything but strings. I thought it would be best to key the hash using the key of the MySQL table, but the key is 'id' and the values are incrementing numbers. Despite this, the error still reports those hash keys as strings. Does this have something to do with the fetchall_hashref? Should I use something other than fetchall_hashref, or is there a way to ensure that when the hash is built they are of type 'HASH' and not strings?

Regards,
Scott


In reply to can't use string as hash ref by spickles

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.