http://qs321.pair.com?node_id=639072

sg has asked for the wisdom of the Perl Monks concerning the following question:

The following code is meant for a Big-endian processor running linux. The code reads binary files and assigns values to C-structures. The same data files need to be read in perl in Windows on little endian x86. Any tips on doing the translation?
typedef struct s_str_boo { unsigned short type; int x; int y; int w; int h; int v2; unsigned short s1; unsigned short s2; } str_boo; typedef struct s_str_foo { unsigned int aui; str_boo boo[16]; unsigned short aus; struct s_str_foo *next; } str_foo; file = fopen("foo.dat", "r+b"); fread((void*)&an_uint, sizeof(char), sizeof(unsigned int), file); fread((void*)tmpfoo, sizeof(char), sizeof(str_foo), file);