in reply to Re: Re: Array of arrays used within object
in thread Array of arrays used within object

Quick and easy optimization (not considering the other changes you are asking about): Replace
$within = 1;
with
return 1;
From your coded logic, there is no reason to continue looking through the rest of the array if you have found a match. You can also drop the declaration of $within and end the sub with
return 0;
since no match was found if it finishes the loop.

Replies are listed 'Best First'.
Re: Re: Re: Re: Array of arrays used within object
by knirirr (Scribe) on Aug 08, 2003 at 09:29 UTC

    Thanks for the suggestions - I've incorporated those.

    Presumably by references you mean something like:

    $positions{$file} = \@nreg;

    Then calling subroutines with:

    &msatminer::addregion($positions{$file},$start,$stop);

    If so, that would be a quick solution that might allow me to do one thing the code doesn't currently do (and should) — identify points that are found between two close features (there are various biologically interesting cases).