sort will sort the array reference by each element of @AoA
join joins the result together using the contents of $;
The resulting string is used as a key to %uniq, and the value is incremented
If the value is one, then True is returned to
grep, and a copy of the original value from @AoA is stored in @r.
Try breaking down a statment like this into its parts, and try each part at a time to see what it does. Experimenting will teach you a lot.