in reply to how to sort string in perl

Sounds like course/homework or an interview question ;) See Sorting Arrays Without using SORT function or search for similar discussions.