in reply to searching for unique numbers into a string

If you look at List::MoreUtils, there is a uniq method that implements what you want. The only fundamental difference between what you are doing and what it does is by using your grep in void context and then calling keys, you are performing the same operation twice.
  • Comment on Re: searching for unique numbers into a string