No, it's no real code, 'identifier' was meant as a generic name for the hash keys.
Making a small script isn't trivial since I gather the data to build the hash and the 'code'-array in several nested subroutines. I did a 'workaround' by now, which means I recoded stuff using more nested 'if'-constructs than in the stripped-down (but functional and error-producing) code below:
for (my $y = 0; $y < $num; $y++) {
for (my $x = $y+1; $x < $num; $x++) {
if (($scores->[$y]->[$x] >= 0.96)) {
if ($blast_par->{$cleancodes->[$x]}->{"taxon"} eq
$blast_par->{$cleancodes->[$y]}->{"taxon"}) {
if (($blast_par->{$cleancodes->[$y]}->{"defline"} =~ m/
+refseq/i) &&
($blast_par->{$cleancodes->[$x]}->{"defline"} =~ m/
+refseq/i)) {
if ($blast_par->{$cleancodes->[$y]}->{"defline"} =~
+m/NP_/) { # this line produces the error
$to_keep = $y;
$to_kill = $x;
}
elsif (($blast_par->{$cleancodes->[$y]}->{"defline"}
+->[$y] !~ m/NP_/) &&
($blast_par->{$cleancodes->[$x]}->{"defline"}
+->[$x] =~ m/NP_/)) {
$to_keep = $x;
$to_kill = $y;
}
}
&generic_sub($to_kill, $to_keep);
}
}
}
}
I think the error has something to do with the 'if'-lines not meeting the
"... =~ m/NP_/" requirement. I split up the if's in a more simple (but also more inelegant ;-) manner and it works now. From
Data::Dumper()-analysis the array and the hash itself are valid.
But anyway, I'd like to have a clear mind about what happened here to avoid such errors in future, so, if anyone's got an idea... ;-)
Micha
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.