in reply to Re: Searching in binary files
in thread Searching in binary files
Danke nach Frankfurt!
There are a few bugs in your code, though. I changed the if to a while loop and fixed a few other problems:
while ($str =~ /searchword/g) { my $loc = tell($fh) - length($str) + pos($str); print "Found a match starting after $loc.\n"; }
Update: That doesn't quite work either... it finds too many occurrences...
In Section
Seekers of Perl Wisdom