in reply to How to search directory

hope this will help you

use strict; use warnings; use Cwd; use File::Find; my $search_pattern=$ARGV[0]; my $file_pattern =$ARGV[1]; find(\&d, cwd); sub d { my $file = $File::Find::name; $file =~ s,/,\\,g; return unless -f $file; return unless $file =~ /$file_pattern/; open F, $file or print "couldn't open $file\n" && return; while (<F>) { if (my ($found) = m/($search_pattern)/o) { print "found $found in $file\n"; last; } } close F; }

usage: perl find.pl (?i)sorting html
The first argument is the regular expression. I use (?i) to
indicate that I want to search case insensitive. The
second argument specifies that only files should be considered
that contain html in their name. Site where the code is available : http://www.adp-gmbh.ch/perl/find.html
Sridhar