in reply to String/Integer Concatenation
The error occur because you're are only initializting $a. Try:
my ($a,$c,$g,$t) = (0, 0, 0, 0);
or
my $a = 0; my $c = 0; my $g = 0; my $t = 0;
Notice the lack of quotes around a numerical zero.
Aside from that,
Fix:
sub comNucCount { my($string1, $string2) = @_; $string1 = uc $string1; $string2 = uc $string2; my %counts = map { $_ => 0 } qw( A C G T ); for my $position (0 .. length($string1)-1) { my $char = substr($string1,$position,1); $counts{$char}++ if substr($string2, $position, 1) eq $char; } return "A=$counts{A}, C=$counts{C}, G=$counts{G}, T=$counts{T}"; }
|
|---|