open $filehandle, "<", $file or die "can't open $file\n"; while (<$filehandle>) { my $line=$_; my $count=0; $count++ while ($line =~ m/\//g); # looks like we found a file-reference if ( $count > 1) { # remove all whitespace now # prefix whitespace $line =~ s/^\s+//; # suffix whitespace $line =~ ~ s/\s+$//; # intermediate whitespace $line=~ s/ //g; # remove everything until first occurance of " $line=~ s/[^\"]*\"//; # chop off all chars after " my $oper = index($line, '"'); my $word = substr($line, 0, $oper); $line=$word; # putting it together # buildpath returns a complete path & filename depending on wich prefix is # used for the current file my $searchfile=buildpath($line); if ( -e $searchfile ) { pdebug(1,"found\n"); } else { pdebug(1,"not found\n"); print "\nunmatched reference in file:\n$file\n"; # findline prints the Linenumber of a string in a file findline($file,$line); print"\ncouldn't find file:\n $searchfile\nreferenced as:\n$line\n"; } } }