
hestes37
Novice
May 20, 2010, 1:40 PM
Post #1 of 12
(911 views)
|
|
writing hex values to a file
|
Can't Post
|
|
Hi folks, I'm very new to PERL, been using it a few weeks. I'm trying to append 4 integers stored in an array to a flat file and I keep getting for example using 1,2,3,4, I get 31 32 33 34. I'm trying to get 1, 2 , 3, 4. code snippet: foreach $hexnum (@versionnum ){ sprintf "%lx", $hexnum; print FILE $nulchar; print FILE $hexnum; } I use the $nulchar to append 0x00 to the byte before each integer I want to convert so I'm writing 8 bytes to the end of the file. Any help I could get with this would be great. Been looking for about a week and still haven't found it. H
|