I'm having kinda of a difficult time visualizing your data, but it looks like you are scanning over @sortedKeys multiple times. Could you rearrange the logic to scan outward from the current item instead of continually scanning over @sortedKeys?
If you could provide a small bit of code that actually uses this sub, giving it data and showing us the expected outcome it might be a fun challenge for some of us! ;) It could be a significantly smaller set of data than you are working with, just enough to show the input/output is working correctly.
Good luck!
In reply to Re: Help tightening up a subroutine please
by eric256
in thread Help tightening up a subroutine please
by mdunnbass
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |