arabic digit indicates instance of a char' "x" indicates no repetition/dupe (6); and roman numerals indicate distinct repeated chars (VI) AT THE FIRST REPEAT my $str = "PERL MONKS ROCKS!!!"; P 1 x E 1 x R 1 I L 1 x 1 repeated later M 1 x O 1 repeated later N 1 x K 1 repeated later S 1 repeated later 2 II R 2 I O 2 III C 1 X K 2 IV S 2 V ! 1 VI ! 2 VI ! 3 VI