http://qs1969.pair.com?node_id=421397


in reply to Unique List of Common Characters Between Two Strings

Since you throw away the hash I think you can simplify the grep a little:

grep $u{ $_ }-- >0, split //, $str
---
alter ego of demerphq

Replies are listed 'Best First'.
Re^2: Unique List of Common Characters Between Two Strings
by Limbic~Region (Chancellor) on Jan 11, 2005 at 19:56 UTC
    de-merphq,
    ...I think you can simplify the grep a little

    I thought about that too at first but it is flawed thinking. If a letter appears more than once then it can go from 0 to a negative number which will again start returning true values. The intention was to only produce a unique list.

    Cheers - L~R

      Yeah sorry, the >0 should be there.. (i updated.)

      ---
      alter ego of demerphq