How to check if file exists case insensitive
Posted on 2009-04-16
I usually check if file exist with
(-e $filename) or die "$filename does not exist\n";
Windows and Mac OS X have case-insensitive file system, but this check is case sensitive. So if $filename='test.TXT', my code return false even if test.txt file exists.
I would like not to use any packages, only standard Perl to be sure it will run on any computer without installing additional packages.
What I can do? There should be an easy solution, but I could not find a good one.
I saw some recommended to do it with ls and grep, but it looks wierd. I cannot believe Perl does not deal with this issue.