Nov 19, 2008 #1 axelro Technical User Nov 19, 2008 3 0 0 GB my $aa = <>; my %a = ( ALA => "A", ARG => "R", ASN => "N", ASP => "D", ASX => "B", CYS => "C", GLU => "E", GLN => "Q", GLX => "Z", GLY => "G", HIS => "H" ); foreach my $key (keys %a) { if ($aa eq $key) { my $b = $amin{key}; print $b, "\n"; } }
my $aa = <>; my %a = ( ALA => "A", ARG => "R", ASN => "N", ASP => "D", ASX => "B", CYS => "C", GLU => "E", GLN => "Q", GLX => "Z", GLY => "G", HIS => "H" ); foreach my $key (keys %a) { if ($aa eq $key) { my $b = $amin{key}; print $b, "\n"; } }
Nov 19, 2008 1 #2 KevinADC Technical User Jan 21, 2005 5,070 0 0 US It must be entering the loop, but maybe you need to chomp() $aa before trying to match one of the hash keys. $aa = <>; chomp($aa); ------------------------------------------ - Kevin, perl coder unexceptional! Upvote 0 Downvote
It must be entering the loop, but maybe you need to chomp() $aa before trying to match one of the hash keys. $aa = <>; chomp($aa); ------------------------------------------ - Kevin, perl coder unexceptional!
Nov 19, 2008 #3 travs69 MIS Dec 21, 2006 1,431 0 0 US Where is $amin{} coming from. Please do not use $a, or $b as variables and use strict!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions; Upvote 0 Downvote
Where is $amin{} coming from. Please do not use $a, or $b as variables and use strict!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;