"If a line begins with ">bla-bla" and if $seq (which appears no where else in the code other than " $seq="" ") exists assign it to the hash "pro" with the name "bla-bla"."
So my question is how does the inner if statement work when seq="" is out side that "if" statement?
Is the outer "if" statement evaluated first then the inner? Because how does the inner "if" statement know what "$seq" is?
I am probably not making any sense but I am trying to figure out mechanically how the perl interpreter knows what to do in the context of the nested if statements.
-Thanks -Mike
Gunnar Hjalmarsson wrote:
That illustrates the importance of indenting the code in a way that makes sense:
while (<align>) {
$line=$_;
if ($line=~/^>(.+)/) {
if ($seq) {
$pro{$name}=$seq;
#print "SEQ:\n$pro\n\n";
}
$name=$1;
$name=~s/\s//g;
push @names, $name;
#print "$name\n";
$k++;
$seq="";
} else {
chomp $line;
$seq.=$line;
}
}Quite a difference, isn't it?
-- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
