Other than that, just a blitz look.
> while ($i < $num) { > $sortedKeys[$i] = $i; > $i++; > }
This can be written simply as
@sortedKeys = (0 .. $num - 1);
> next unless defined %{$matches{$fasta_id}}; > last unless defined @{$matches{$fasta_id}{$site}};
These may not always be true, but they autovivify an element so *will* be true the second time over you test them with the same key.
> # as @fastarray is global, this will have global effect, and we do +not need to return it. > > @fastarray=@newfast;
If the array is big, you'd do much better just updating a reference to it rather than the above, as you are copying all the elements. Avoiding globals wherever you can is generally a good idea...
Update: Most of my points contained mistakes: see below for corrections by kyle++ and BrowserUk++. That'd teach me to post when tired. The advice against globals is probably sound though. :-)
In reply to Re: Help tightening up a subroutine please
by gaal
in thread Help tightening up a subroutine please
by mdunnbass
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |