in reply to Create sort function from a text file
Addressing what I believe to be the "X" of this "X-Y" problem: have you looked at Sort::Naturally?