perl sorting algorithms and scala run script