For your first question, I think you could use
pack() function.
By the way, reading pack()'s section in
perlfunc man page, I read:
Note that Perl uses doubles internally
for all numeric calculation ...
It seems to me a bit peculiar.
Could someone give me an explanation?