i'm parsing files and trying to find a given variable followed by a dot.
so, the file that i'm parsing is this:
package blah.blah.blah;
import blah.Log;
public void addLeadType(LEAD_TYPE type) {
_leadTypes.add(type);
}
// ** PROTECTED METHODS
// ** PRIVATE METHODS
// ** ACCESSORS
// ** INNER CLASSES
}
and the perl code that i'm using to find a word in that file:
#!/usr/bin/perl
undef $/;
sub fileContainsWord() {
my $file = $_[0];
my $word = $_[1];
my $found = 0;
open FILE, "<$file";
while(<FILE>) {
my $filecontents = $_;
if($filecontents =~ /$word/smg) {
$found = 1;
last;
}
}
close FILE;
return $found;
}
my $file = "SearchSet.java";
my $word = "LEAD_TYPE.";
my $flag = &fileContainsWord($file, $word);
print $flag . "\n";
for some reason, it's not picking up the trailing dot in $word, and flag is coming back '1'
why is this?