if ($line =~ /^$begin/) #$begin="ORIGIN"; { &body;} sub body { while ($line = ) { chomp ($line); if ($line !~ /^$end/) { #$end =" \/\/" $line =~ s/[0-9]//g; # $line =~ s/\s+//g; # $line =~ s/\n//g; chomp ($line); #$line =~ /([atcgn]+)/g; print OUT "Genome: \n $line\n"; } else { last; } } }