in reply to Refactoring copy-pasted code
I've also been thinking about a copy-paste detector, and there turns out to be a fair amount of prior art.
If you Google for "copy paste detection", and "code duplication" you'll find plenty of software, although mostly for Java or C#.
I've tried DuDe, which is kinda useful but far from perfect.
In Section Seekers of Perl Wisdom