I have encountered this problem in the past. I hit a small little program that uses PPI to find routines. It normalizes the code a bit (space is normalized, comments are deleted) and reports any duplicates. It works well. PPI does all the hard lifting.
You can make normalization a little smarter by normalizing all variable names in each subroutine to $ a, $ b, $ c, and possibly doing something similar for strings. Depends on how aggressive you want to be.
#!perl use strict; use warnings; use PPI; my %Seen; for my $file (@ARGV) { my $doc = PPI::Document->new($file); $doc->prune("PPI::Token::Comment");
Schwern
source share