Hi dear monks!

I'm having problems in using a regexp and hashed hashes. I have the following variables:

$code = reference to an array holding identifiers $hashhash = reference to a hash

The hash has the following form:

$hashhash = { 'identifier' => {'score' => 7, 'query_start' => 80, 'query_end' => 1292, 'subj_start' => 367, 'subj_end' => 1563 'e_value' => '5e-12', 'defline' => 'description', 'taxon' => 'Homo sapiens', }, 'identifier' => {...} }

My buggy code looks like this:

if ($hashhash->{$codes->[$x]}->{'defline'} =~ m/NP_/) { do_something; }

$x is cycled from 0 to scalar(@{$code}); and I'm searching for 'NP_' in the defline. The code crashes with:

Can't use string ("description") as an ARRAY ref while "strict refs" in use at /home/spitzem/wp/retr_standaloneblast_ +ABCGfam.pl line 589 (#1) (F) Only hard references are allowed by "strict refs". Symbolic references are disallowed. See perlref.

I don't see any where I use the description-string as an ARRAY-reference. The problem is that some cycles work flawlessly, but then it crashes and I don't see any difference or reason what could explain this behaviour. Any hints are welcome, I'm just at the edge of knocking my head on the table... ;-)

Cheers, Micha


In reply to strict refs and REGEXP error by professa

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.