local $/;
You have this at the top level. I think it's more clear to say undef $/;. The form using local is good if you're doing this inside a block and don't want to meddle with the value outside your block.
open(FH, $file) or die "File couldn't be opened";
I'd say:
open my $fh, '<', $file or die "Can't read $file: $!";
The three argument open saves you from some odd cases, and the error message including the filename and $! tells you a lot more about what failed and why.
I'd move those lines up to immediately after the pattern match and keep them there. If you add some intervening code later that uses a pattern match, these won't work. Also, these expressions might be clearer as, for example, my $start = $1 - 1 instead of the separate decrement.
Your html_out would be better off accepting a hash reference instead of trying to stuff the whole hash in as arguments. You'd call it as html_out($total_mutations, \%mutant_genes) (note the backslash), and it would take its arguments like so:
sub html_out { my ( $total_muts, $mutant_genes_ref ) = @_; my %mutant_genes = %{$mutant_genes_ref}; # ...etc... }
The rest of the code wouldn't change. I don't think it's a big deal in this case since %mutant_genes is global anyway (by_descending_probability is already using it). Have a look at reftut for more about references.
On the plus side, I found it pretty readable (though I ignored the big hunks of HTML), and the comments are good.
In reply to Re: Genome UV Mutation Script -- Critique
by kyle
in thread Genome UV Mutation Script -- Critique
by c4onastick
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |