Hi...
I am trying to make a program that ask for a specific DNA number, where the program have to check if the given number is in a specific given list... here the program should tell me if they are or arent in the list..the program runs untill I write stop.... hope someone can help me...
had tried this:
use strict;
# step 1. read the file:
my $accessionno = ' ';
my $line = ' ' ;
my @arr = ( );
my $match = ' '; #was anything found?
my $search = ' '; # thing to seach for
my $element_position = ' ';
my $found = ' ' ;
open( IN, '<', "clean1.acc") or die "cant read file\n";
while (defined ($line = <IN>)) {
chomp $line;
push @arr, $line;
}
close IN;
# step 2.ask for accession number untile it stop using STOP , also searshing the number:
while($accessionno ne "STOP"){
print " which Accession number are you searching for?\n";
chomp ($accessionno= <STDIN>);
for($element_position= $#arr; $element_position >= 0 ; $element_position--) {
if($arr[$element_position] eq $accessionno) {
print "congratulation the accession number is in the given list!\n";
}else{
if (!$match){
print "nothing found!\n"
}
}
}
}
__END__
I dont know what I am doing wrong but i can figure out that i have to save the found number ......?
Thanx