sub fileExists { my $dir = shift; my $file = shift; # case insensitive grep on filenames my @exists = grep { lc("$dir/$file") eq lc($_) } glob($dir/*); # returns an array, you want to know if more than one file matches }