in reply to Re^4: Problem on substr record on binary file
in thread Problem on substr record on binary file

Without actually testing your code, that seems to be OK. A couple of things to improve it though: you should always test the return value from open,
open (DATA, "$indir/$infile") or die "Unable to open $indir/$infile: $ +!";
would be a conventional way of doing that. Notice also that read returns the number of bytes read, which you can use to check that you get back the number you expect - if data can be wrong it will be!