in reply to Sorting names
My bets are that you just want a simple @sortednames = sort { lc($a) cmp lc($b) } @names. If that syntax is unclear, check the sort docs for further info.
-Paul