Use a hash-of-arrays to group the paths by filename.
my %sourcesAndPaths; foreach (@classedSources) { my ( $dir, $file ) = m{ ^ (.+) / ([^/]+?) $ }x or do { warn "Can't parse '$_'"; next; }; push @{ $sourcesAndPaths{$file} }, $dir; } foreach my $file ( sort keys %sourcesAndPaths ) { my @dirs = @{ $sourcesAndPaths{$file} }; next if @dirs == 1; print "\n$file\n"; print "\t$_\n" for @dirs; }
In reply to Re: sorting a filelist array by filename
by Util
in thread sorting a filelist array by filename
by Vasek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |