Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
eg. I want this to recognize $Acount is higher than $Ccount and store the letter A in $consensus. However when I print out $scoring[$i] and $scoring[$j] I was hoping to see the numbers 4 and 3 printed, not $Acount and $Ccount.$Acount = 4; #I have set these values $Ccount = 3; #eventually they will come #from the program looking at #a line in a file $i=0; $j=1; #############WHICH SCORE IS HIGHEST ?############# @scoring = qw ($Acount $Ccount $Dcount...more letters here); @con = qw (A,C,D...more letters here); print "$scoring[$i] \n"; print "$scoring[$j] \n"; if ($scoring[$i]>$scoring[$j]) { $consensus = $con[$i]; $score = $scoring[$i]; } print "consensus is $consensus with a score of $score \n";
Should I be using an associative array or something, or is this approach just not gonna work ? Thanx
basm100
Edit by dws to add more <code> tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: values within arrays
by fs (Monk) on Feb 28, 2002 at 14:26 UTC | |
|
Re: values within arrays
by jlongino (Parson) on Feb 28, 2002 at 17:46 UTC |