How to optimize a table in a perl script : I have an issue with my perl script. 
It parses a file like this :

        chr   start   end   strand
        chr1  11870	11891	+
        chr1  28537	28558	+
        chr1  46502	46523	+
        chr1  39909 39930   -
        chr1  43896 43917   -
        chr2  62774 62795   -
To `pairs` positions. When the strand is `+` it keeps the start and search all the end of strand `-` to pair. The results is like this :

        11870   39930
        11870   43917
        28537   39930
        28537   43917

To do this, I make two tables. I make a table with all the `start` of `+ strand` and another one with all the `end` of `- strand`. After, for each `start` in my table of `start position` I search the `end` (in the table `end position`) which is bigger than my `start`.

 My issue is that it takes too much time and I try to think about something which do not need to make two tables or with "dynamic table". Do you have an idea to search without these two tables?

Thank you for your help.
        