Hi all,
this might be quite a newbie question, but i need to process a certain text file and dump its content into a binary file and i do not know how - i decided to use perl, but my perl skills are quite low. I probably should have written this in C++, but this seem like a nice and easy task for perl, so why not learn something new? ;) The text file has thousands of lines in this format:
2A02FC42 4
You can look at it as a hexadecimal number (the length is ALWAYS 8) and a regular number. Now i need to dump all the lines into a binary file in this format (it should look like this when viewed with a hex editor):
42FC022A00000004
More examples so it is clear:
70726F67 36
-> 676F727000000024
6A656374 471
-> 7463656A000001D7
The part of parsing the input file is easy, but i'm stuck on the second part, where i should write this into a binary file. I have no idea how to format the data in this way or even how to output things in binary mode. Can someone help me out here?
Thanks.
EDIT: updated the examples, forgot about endiannes - im on a LE system.