{ open (IN, $file) || die "Can't open $file\n"; my $tag; my $seq; while () { chomp; if (/^>/) { if ($seq) {$protein{$tag} = uc($seq); undef $seq} $tag = $_; } else {$seq .= $_} } $protein{$tag} = uc($seq); # add this line to get the last sequence close IN; }