#!/usr/bin/perl # non recursive case insensitive search down # thru current directory for pattern in filenames. use warnings; use strict; use File::Find; $|++; my $search = $ARGV[0] or die "need search pattern $!\n"; my $path = '.'; my $regex = qr/\Q$search\E/i; find (sub { #prevent recursion into subdirs my $n = ($File::Find::name) =~ tr!/!!; #count slashes in file return $File::Find::prune = 1 if ($n > 1); return if -d; # return unless (-f and -T ); # limit to text files print "$File::Find::name\n" if /$regex/; }, $path);