in reply to Reading through a file and checking for a specific string

vihar:

I'd suggest putting in a print statement to show the values as you process them. For example, just after extracting your small string, you could print the line number, the bit you extracted and the complete line:

$var = substr($str, 41, 2); print "$.: $var: $str\n";

Then make a small test file, and run your code against the small test file to see if you get what you're looking for. That ought to help you find the problem in short order.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^2: Reading through a file and checking for a specific string
by vihar (Acolyte) on Aug 19, 2013 at 20:17 UTC
    Thanks for your reply. That was the first thing I did to really figure out what's going in but couldn't get anywhere with it. It was printing out a bunch of values and they were not correct.