Hm, somehow I missed that. Given the extra bit of data you supplied, I might recommend the use of List::MoreUtil's firstidx and lastidx functions. The fact that it's XS ought to help with the speed.
# for clarity... my $result; my $src = $matches{$fasta_id}{$sitekey}; # Use a slice and firstidx/lastidx to copy the range of values @newArray = @$src[ (firstidx {$_ >= $lowerlimit} @$src )..(lastidx {$_ <= $upperlimit} + @$src) ]; $result = \@newArray;
In reply to Re^3: Help tightening up a subroutine please
by radiantmatrix
in thread Help tightening up a subroutine please
by mdunnbass
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |