When you have to read and write binary data using Perl, then you preferably use the built in functions pack and unpack. With the pack function you will create a string which will be different depending on what kind of template you provide to the pack function (the unpack does the same, but in the opposite direction).
I was writing a simple Perl script that was reading a binary file which
contained data that originated from a c struct
. I …