There are many ways to pack that, depending upon what is going to read it back and the ranges of the values.
For example, if you are reading it back in the same or another script; the ineteger is unsigned and you want to retains full double precision, then:
$packed = pack 'C/A* N d', 'ewh2442', '018234', 35.67;;
print for unpack 'C/A* N d', $packed;;
ewh2442
18234
35.67
But if another program is reading it back and is expecting a particular format; or if the string has to be a fixed length; or if the integer is signed; or if the integer can only range up to +-32767/0-65535; or you don't want to use 8-bytes for each float but rather only for; or if the reader is going to be on a different platform which uses a different endianess; then you might would need a different template.
Essentially you need to tell us a lot more before we can give you definitive help.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|