in reply to Removing with regexps

Here's another option:

for(split /\n/, $old_entires) { my($count, $num, $new_entry) = qw(0 0); map{$new_entry .= $_ . ($count++ < $num-1 ? '(' . $count . ')': "\ +n")} grep{!/\(arch\)/ && ++$num} split / ?\(\d\)/; print $new_entry; }

Hope this helps!