Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Use of uninitialized value

by frozenwithjoy (Curate)
on Aug 11, 2013 at 04:45 UTC ( #1048972=note: print w/ replies, xml ) Need Help??


in reply to Use of uninitialized value

Assuming line 64 is $lnPAM1[$i][$j]= ($lnPAM1[$i][$j]) /($mutrate*100);, you could try troubleshooting with something like this on the line before:

say "$lnPAM1[$i][$j]:$i:$j";

When I do this I see something like this snippet:

-3.91202300542815:3:7 -3.50655789731998:3:8 :3:9 :3:10 :3:11 :3:12 :3:13 :3:14 :3:15 :3:16 :3:17 :3:18 :3:19 -4.60517018598809:4:0 :4:1 :4:2 :4:3

Taking a look at where the matrix is built, it seems that the problem stems from your use of next in:

LINE: for (my $i=0; $i<20; $i++){ for (my $j=0; $j<20; $j++){ if ($matrix[$i][$j] > 0){ $lnPAM1[$i][$j] = log $matrix[$i][$j]; }else{ next LINE; } } }

By using next, you don't use all 20 iterations of i or j when building the matrix, but you do later on. You could look to see the dimensions of the matrix before iterating through its dimensions.


Comment on Re: Use of uninitialized value
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1048972]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2015-07-07 20:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls