Thanks, for your help. I appreciate it. I am trying not convert the vec to an array because I don't have that much memory. I created a couple different sorting functions where I do switch the bitstrings myself. I used the algorithms for insertion, substitution and quicksort just to do a comparison on which one would be the best for this type of problem. Insertion and substitution are really slow once I try to sort a vec of a million integers which makes sense but I had to try. Quicksort right now is giving me problems, I think due to recursion but I am not certain. I was hoping there was clever way to do it within Perl. I wanted to say thanks for the help!