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.

Replies are listed 'Best First'.
Re^2: reading binary files with Perl
by jpk1292000 (Initiate) on Nov 16, 2006 at 19:09 UTC
    Got it working. Thanks for help. My problem was two-fold. I wasn't using the correct record length, and I wasn't using bin mode. Once I fixed these two issues, it worked.