in reply to Genome UV Mutation Script -- Critique

Looks fine. One thing that jumps out at me is that your regex for counting locations, /[ct](?=[ct])/g, is duplicated, and at the same time is being used two different ways. I'd probably stick that in a subroutine and call it in both places. Perhaps something like

sub count_possible_mutation_locations(\$) { my $sr = shift; scalar( () = $$sr =~ /[ct](?=[ct])/g ) }
A word spoken in Mind will reach its own level, in the objective world, by its own weight

Replies are listed 'Best First'.
Re^2: Genome UV Mutation Script -- Critique
by kyle (Abbot) on Mar 14, 2007 at 21:54 UTC

    Why use a prototype here? And why take a reference to the string?

    sub count_possible_mutation_locations { return scalar ( () = $_[0] =~ /[ct](?=[ct])/g ); }

      Oh, no particular reason to in this case. Sometimes I like to do this to get a little bit of typesafety.