#!/usr/bin/perl -w use strict; #File below is decompressed http://perl.org/CPAN/modules/02packages.details.txt.gz open(MODULES, '<', '02packages.details.txt') or die "Can't open module info: $!"; my %all_modules; my %duplicates; my $inheader = 1; #02packages.details.txt has several header lines, then a blank line, then the module names. while () { if ($inheader) #This technique for ignoring the header was taken from { #Merlyn's MINICPAN script: http://www.stonehenge.com/merlyn/LinuxMag/col42.html $inheader = 0 unless /\S/; next; } my ($module, undef, undef ) = split; if(exists $all_modules{lc $module}) { push @{$all_modules{lc $module}}, $module; $duplicates{lc $module} = 1; } else { $all_modules{lc $module} = [$module]; } } print scalar(keys %duplicates)." sets of duplicates:\n\n"; foreach(sort keys %duplicates) { print join ' | ', @{$all_modules{$_}}; print "\n"; }