in reply to reading binary files with Perl
Depending on your OS, another problem is the lack of binmode. Add binmode(FH) after the open so that Perl doesn't mess with the data. Not all OSes require binmode, but it's safe to use binmode on all OSes.
Oh and I'd use l instead of i. i is not guaranteed to be 4 bytes.