Though I haven't used it for this purpose, the docs for Algorithm::Diff suggest that you can call its Same method instead of the Diff method to get the similarities instead of the differences.
Phil
Comment on Re: Refactoring tools for copy/paste jobs