BhariD has asked for the wisdom of the Perl Monks concerning the following question:
I am doing a multiplication
#!/usr/bin/perl use strict; use warnings; use integer; my %iupac_dgn; my @iupac_code=('M','R','W','S','Y','K','V','H','D','B','N'); my @iupac_den=('2','2','2','2','2','2','3','3','3','3','4'); @iupac_dgn{@iupac_code}=@iupac_den; my $string = 'GGNMDNNSNNNNDBNVWVSMNNHYNBNG'; my @residues = split(//, $string); my degeneracy = 1; foreach my $residues(@residues){ if(grep($_=~m/^$residues$/, keys %iupac_dgn)){ my $factor = $iupac_dgn{$residues}; $degeneracy = ($factor * $degeneracy); } } printf PRIMER_PAIRS "%28s, %30d", $string, $degeneracy;
for this particular string, it gives me a number with '-' in front '-1073741824'. am I doing something wrong here.. can anyone please help me
Thanks!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: negative numbers when doing multiplications?
by moritz (Cardinal) on Mar 26, 2010 at 13:30 UTC | |
by chuckbutler (Monsignor) on Mar 26, 2010 at 14:03 UTC | |
by tye (Sage) on Mar 26, 2010 at 20:46 UTC | |
by almut (Canon) on Mar 26, 2010 at 22:16 UTC | |
by ikegami (Patriarch) on Mar 26, 2010 at 22:34 UTC | |
| |
Re: negative numbers when doing multiplications?
by almut (Canon) on Mar 26, 2010 at 14:29 UTC | |
Re: negative numbers when doing multiplications?
by Anonymous Monk on Mar 26, 2010 at 13:27 UTC |