What the script should do is strip off the header of a number of targa files, concatenate what's left together, and then write a new header for the final file. The only part of this that is causing me problems is writing a new header. I know what each and every byte in the 18 byte header needs to look like, but how do I tell perl to write 240 (or 0x00f0) to the output file in binary and actually have the binary file contain that information? I re-wrote this in C just to make sure the logic of it all is correct, and it works perfectly fine. Here's kind of what I'm doing:
$temp = 0x00f0;
write(FH,$temp,2);
This should take the value in the scalar $temp and write it to where the file handle FH is currently pointing for a size of two bytes, correct? It's certainly not working that way. Octal display (od -x bin) of the file isn't producing the 0x00f0 that the similar C code can do, it's writing 0x3432. Make any sense to anyone?
$temp = 0x00f0;
write(FH,$temp,2);
This should take the value in the scalar $temp and write it to where the file handle FH is currently pointing for a size of two bytes, correct? It's certainly not working that way. Octal display (od -x bin) of the file isn't producing the 0x00f0 that the similar C code can do, it's writing 0x3432. Make any sense to anyone?