in reply to Range question

Are you absolutely sure that your binary data cannot contain (an) EOL character(s)? Because if it does you, cannot read the file on a line-by-line basis.

This leads me to think of an alternative solution.

Read your whole file into a scalar and use

split /\*start\*of\*junk\*data\*.*?\*end\*of\*junk\*data\*/, $my_whole +_file
to get at your binary data. Of course this will only work if your whole file can fit within one scalar.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James