in reply to sorting arrays

ucanflyit,
Perhaps you should read the man page on uniq.
sort file | uniq -c
The obvious Perl solution is to use a hash an increment the key each time the item is found. If original order is important, in addition to the hash, push the value into an array unless the key already exists in the hash. You can use the array to get a hash slice in the original order.

Cheers - L~R