Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Thanks Kevin , can you see this one too? :) 1

Status
Not open for further replies.

axelro

Technical User
Nov 19, 2008
3
0
0
GB
When i put it in subroutine still doesn't work, thogh by itself it does?

use strict;

sub Convert;

my $aa =<>;
chomp($aa);
my $c = Convert($aa);
print $c, "\n";


sub Convert
{

my $a = @_;

my %amin = (
ALA => "A",
ARG => "R",
ASN => "N",
ASP => "D",
ASX => "B",
CYS => "C",
GLU => "E",
GLN => "Q",
GLX => "Z",
GLY => "G",
HIS => "H",
ILE => "I",
LEU => "L",
LYS => "K",
MET => "M",
PHE => "F",
PRO => "P",
SER => "S",
THR => "T",
TRY => "W",
TYR => "Y",
VAL => "V"
);

my $b;
foreach my $key (keys %amin) {
if ($a eq $key) {
$b = $amin{$key};
}
}

return $b;
}
 
this is wrong:

my $a = @_;

should be:

my ($a) = @_;

or:

my $a = $_[0];

or even:

my $a = shift;

Please note, student posting is not allowed here

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top