in reply to Opening certain files

It's odd that you talk of the file being defined in terms of C++ structs, since I think C++ doesn't define the memory layout of structs.

There is Convert::Binary::C, but it's usually simpler just to use unpack. You can read blocks of the appropriate size using read or by setting $/ appropriately with readline (aka <>).

(Too slow!)

Replies are listed 'Best First'.
Re^2: Opening certain files
by mjscott2702 (Pilgrim) on Nov 09, 2010 at 08:44 UTC
    Would the readline approach still work if it was a packed binary file, with fixed size records ("structs") with no end-of-record indicator?

    In this case, wouldn't it be necessary to binmode the filehandle and read the required number of bytes, before unpacking?

      Would the readline approach still work if it was a packed binary file, with fixed size records ("structs") with no end-of-record indicator?

      I said it would. Did you got read the documentation to which I linked?

      wouldn't it be necessary to binmode the filehandle

      Yes, no matter which method you use.