in reply to Help tightening up a subroutine please
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. :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help tightening up a subroutine please
by kyle (Abbot) on Jan 23, 2007 at 18:37 UTC | |
by gaal (Parson) on Jan 23, 2007 at 22:06 UTC | |
by ikegami (Patriarch) on Jan 23, 2007 at 18:49 UTC | |
|
Re^2: Help tightening up a subroutine please
by BrowserUk (Patriarch) on Jan 23, 2007 at 18:42 UTC |