use File::Find; use strict; use integer; my $filecounter = 0; my $dir = @ARGV[0]; @ARGV[1] =~ m/(.*)(\.){1}(\w+)$/g; my $filename = $1; my $filesoftype = $3; my $stringtosearchfor = @ARGV[2]; print "Looking for files of type $filesoftype in $dir containing $stringtosearchfor\n"; sleep 10; find(\&lookingfor, $dir); print "Found $filecounter files of type $filesoftype!\n"; sub lookingfor() { if (($_ =~ m/\.+($filesoftype)+$/io) && (-f $_)) { $filecounter++; open INPUT, "<$_" || die "Unable to open $_ for examination: $!\n"; while(my $line = ) { chomp $line; if ($line =~ m/$stringtosearchfor/gio) { print "Found match in $File::Find::name at line $.\.\n"; } } close INPUT; } }