*** First record (4 byte integer) - byte size of record (4*N) (f77 header) (4 byte float) .. value 1 (4 byte float) .. value 2 ... (4 byte float) .. value N N = number of grid points in the field (4 byte integer) .. byte size of record (4*N) (f77 trailer) **** Second record (4 byte integer) - byte size of record (4*N) (f77 header) (4 byte float) .. value 1 (4 byte float) .. value 2 ... (4 byte float) .. value N N = number of grid points in the field (4 byte integer) .. byte size of record (4*N) (f77 trailer) #### my $out_file = "/dicast2-papp/DICAST/smg_data/" . $gfn . ".bin"; #path to binary file my $template = "if262792i"; #binary layout (integer 262792 floats integer) as described in the format documentation above (not sure if this is correct) my $record_length = 4; #not sure what record_length is supposed to represent (number of values in 1st record, or should it be length of variable [4 bytes]) my (@fields,$record); open (FH, $out_files ) || die "couldn't open $out_files\n"; until (eof(FH)) { my $val_of_read = read (FH, $record, $record_length) == $record_length or die "short read\n"; @fields = unpack ($template, $record); print "field = $fields[0]\n"; }