in reply to Can't remove the the duplicate element when it's the last one in the array
Take a look at the uniq() function in List::MoreUtils for an elegant (perlish) solution.