in reply to Indexing multiplicate firstnames with regex

my %tot_count; ++$tot_count{ (/(\S+)/)[0] } for @full_names; my %cur_count; s/(\S+)/ $1 . ( $tot_count{$1} > 1 ? ++$cur_count{$1} : '' ) /e for @full_names;

Update: Fixed bug.