My problem is as follows: I have a double hash called 'quantum' which references arrays. One hash is for an i.d. number, while the other is for a date. (So each quantum{$id}{$date} is an array organized by id and date). When I try to run my code, it stops at the same line each time, complaining about my use of a string (the date) as a HASH ref. It seems to complain about different date strings from my .csv file each time I run it, if that helps. It also says the error occurred at the final line of the .csv file. The second foreach loop in the code below is the line of code where the error is found. I've omitted what's inside the loops since it doesn't seem to affect the error.

foreach $id (sort keys %quantum) { foreach $date ( sort {$a->{int(substr($quantum{$id},2,2))} <=> $ +b->{int(substr($quantum{$id},2,2))} || $a->{int(substr($quantum{$id},0,2))} <=> $b->{int(substr($q +uantum{$id},0,2))} } keys %{$quantum{$id}}) { } }

In reply to Can't use string as a HASH ref by tentacoolstuff

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.