in reply to sorting a filelist array by filename

Something like this (not tested):
use strict; use File::Basename qw(fileparse); my %paths; for my $source (@classedSources){ my ($file,$path) = fileparse($source); push @{$paths{$file}}, $path; } print "\n"; print "-" x 80, "\n"; print "-- REPEATED SOURCE(S):\n"; print "-" x 80, "\n"; my @duplicate_paths = grep { scalar @{$paths{$_}} > 1 } keys %paths; for my $dup (@duplicate_paths){ print "\n$file" . join("\n ", @{$paths{$dup}}); }