$searchstring = "usr/include/malloc.h"; $k = 0 ; $n = 0 ; sub recDir { my $f; my @theDir; my $DIR; my @theDir; system "pwd"; my @dfiles; @dfiles = glob("*.d"); foreach $f (@dfiles) { $k=$k+1; printf ("\n$k.)found $f \n"); $n=0; open(IN,'<'.$f) || die "Can not open file $datei: $!"; while(){ $n=$n+1; printf "$n.)$_"; } if ($_ =~/$searchstring/i) { print "\nfound in IN\n" } else { print "\nnot found\n" } close IN; } if (opendir ($DIR, ".")) { # print "+\n"; @theDir = readdir($DIR); foreach $f (@theDir) { unless ( ($f eq ".") || ($f eq "..") ) { # printf "-$f\n"; if (-d $f) { # printf "+$f\n"; chdir($f); recDir($f); chdir(".."); } } } } else { print "can't open Dir $sourcefile $! \n"; $globalerror = 1; } } chdir($ARGV[0]); recDir($ARGV[0]);