I am reading a file, containing integers using the “33441122” byte order. How can I convert the file to the “11223344” (big endian) byte order? I have tried a few things, but I am really lost.
I have read a lot about Perl, but when it comes to swapping bytes, I’m in the dark. How can I convert this:
33 44 11 22
into this:
11 22 33 44
using Perl.
Any input would be greatly appreciated 🙂
You can read 4 bytes at a time, split it into individual bytes, swap them and write them out again
This will be called on the command line as
outfile.binwill be overwritten.