"BD" <> wrote:
> All right,I changed my script but it is giving me some warnings,and I
> check that too ,everything is fine so should I Ignore that warnings?
No, don't ignore the warnings.
> while( <$file2>){
> chomp ;
> ($header1,$seq1)=split"\n",$_,2;
> $seq1 =~s/\n//g;
> #print $header1,$seq1;
> print $hash{$seq1};
> }
> close $file2;
Please indent your code for readability. Also, you should
declare $header1 and $seq1 here, rather than up top.
>
> Warnings are
> Use of uninitialized value in substitution (s///) at file1.pl line 26,
> <$file2> chunk 1.
> Use of uninitialized value in hash element at file1.pl line 28,
> <$file2> chunk 1.
> Use of uninitialized value in print at file1.pl line 28, <$file2> chunk
> 1.
>
> Here it is considering that $seq1 has no value ,but it is giving output
> too.
You are in a loop. One time though the loop it is undefined. Another
time through the loop it does have a value. Note that your first loop
has a "next unless length $_;" which your second loop doesn't have.
When trying to warnings from inside loops, it is often useful to add a
'warn "Starting loop";' at the start and a 'warn "Ending loop";' at the
end. Then you will know which iteration is producing which warning.
> and Is there any way that along the output I can print the header no.
> too in this case it will print 2.
Since the header number is already embedded in the header, I fail to see
the point of that. But it is easy to do, in a variety of ways.
$hash{$seq}=(1+keys %hash) . ": $header";
Xho
--
--------------------
http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB