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 reply to Re^2: Searching in binary files
by crenz
in thread Searching in binary files
by crenz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |