http://www.perlmonks.org?node_id=981125


in reply to get list of files matching part of file name

Here is a File::Find solution
#!/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);

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh