Ok here is the code, is doing almost everything that I want ecxept for when I put exit I wanted to print the answer. For example put in my ID and my DNA X amount of times and them write exit and print out the hash. here is the code
#!/usr/bin/perl
use strict;
use warnings;
my %hash;
print ("put ID fallowed by a comma "," with the DNA for that ID\n\n");
chomp (my $in=<STDIN>);
while ($in) {
if ($in=~ /exit/i){
exit,}
#Split the input on a coma into a maximum of two fields
my ($id,$dna)= split m/,/, $in, 2;
$hash{$id}= $dna;
print "Please enter another ID and DNA\n";
chomp ($in= <STDIN>);
}
#Print hash contents
while(my($key,$value)= each %hash){
print ">$key
$value\n";
}
|