I'm not sure if you wanted to number each instance, or just put the line number on each line where you had a double. Anyway, I did the latter. Here is a very short script which does it. I urge you to learn certain idioms, like the while(<>){} loop and the fact that a for loop where you don't specify a variable defaults to $_ (so you can just do for (@lines) and the line will automatically be in $_). I also here used the special variable $. which is the current line number (actually current input record number, which is normally a line). Feed this script the name of the file on the command line.
Learn the features of perl that make it beat the crap out of C for text processing!! Cheers!
Code:
#!/usr/bin/perl
while (<>) {
s/((.)\2)/(\1)/g ? print "$. $_": print;
}