in reply to Byte repetition check

It seems doing it this way will not work out in the end. And the issue is because when I move from reading 1 byte, to 2 bytes or more, I think what you call alignment becomes an issue. When 2 bytes are read at a time, 011110, $byte becomes 01 then 11 then 10, and common sense will tell you there is repeating byte sets in there.'11' and '11' but it doesnt catch it when 2 bytes are read, and so on with a larger read.

Sooo... if I want to read 2 bytes at a time, I will have to read from the beginning of the file, then calculate how many reps, then seek 1 byte and do it again. Would that take care of this "alignment" issue?

Replies are listed 'Best First'.
Re^2: Byte repetition check
by FloydATC (Deacon) on Dec 11, 2014 at 11:29 UTC

    Why not read the file (or blocks of it, if it's too large to conveniently fit into memory) into a buffer and then process that buffer?

    This would add a couple of lines of code, but it would save you thousands of system calls and improve performance immensely.

    Looping through a buffer could then be done using substr() or by split()ting the buffer into an @array which you can then foreach() through.

    -- FloydATC

    Time flies when you don't know what you're doing