This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
threads - miscellaneous
[perl5.git] / Porting / checkcase.pl
CommitLineData
772ab650
JM
1#!/usr/bin/perl
2# Finds the files that have the same name, case insensitively,
3# in the current directory and its subdirectories
4
5use warnings;
6use strict;
7use File::Find;
8
9my %files;
10find(sub {
11 my $name = $File::Find::name;
12 # Assumes that the path separator is exactly one character.
13 $name =~ s/^\.\..//;
14 push @{$files{lc $name}}, $name;
15 }, '.');
16
17my $failed;
18
19foreach (values %files) {
20 if (@$_ > 1) {
21 print join(", ", @$_), "\n";
22 $failed++;
23 }
24}
25
26print "no similarly named files found\n" unless $failed;