http://qs321.pair.com?node_id=1214491


in reply to Re^2: RFC: Is the Bible encoded in DNA?
in thread RFC: Is the Bible encoded in DNA?

Nobody has spotted the obvious, that the code for reading the file is painfully slow.

A significant improvement would be:

while (read($fh, my $char, 1) && $eof) { if ($char =~ m/[ACGT]/ ) { $i++; if ($i >= $start_genome && $i < $end_genome) { push (@genome, $char); } elsif ($i > $end_genome) { $eof = 0; # do the searching here, instead of outside the loop! } } }