![]() |
|
Perl Monk, Perl Meditation | |
PerlMonks |
forming a word from an array of its bytesby pidloop (Novice) |
on Apr 07, 2021 at 22:14 UTC ( [id://11130974]=perlquestion: print w/replies, xml ) | Need Help?? |
pidloop has asked for the wisdom of the Perl Monks concerning the following question:
Oh great ones!
I have an array containing four integral values, each of which we may assume is less than 256. I wish to combine them into one 32 bit native integer in little-endian format.
The following code does what I want by printing 67305985:
which you may convince yourself is correct by running
My question is: how can I do this without a loop? I have played around with pack, unpack and join but have not yet found a way. Many thanks for your time and wisdom.
Back to
Seekers of Perl Wisdom
|
|