in reply to discovering motifs
The problem is that you've declared lexical variables with my then use them within subroutines without passing them in explicitly or assigning to them from the return values of your subroutines.
For example:
my $combinations2; # ... sub create_motif2 { #creates every possible 6-mer my $base2 = join ",", qw/a t c g/; my $L2 = 6; my $string2 = "{$base2}" x $L2; my $combinations2 = glob $string2; #print join ":", $combinations2; return join ":", $combinations2; }
The $combinations2 declared within the subroutine is fine. It's actually a really good idea. However, it shadows the $combinations2 declared at the top of your program. That's a problem because you use the outer $combinations2 elsewhere in the program without actually assigning to it anywhere.
You could fix just this one case with:
to the subroutines that need it.my $combinations2 = create_motif2();</p> <p>Then pass <c>$combinations2
Applying that type of change throughout your program will clear up many similar bugs in waiting. I can't guarantee that will make everything work, but it will help.
|
|---|