in reply to using pack() to build a 16 bit word

Use bitshifts and bitwise or to get all the values into one number then pack them at once.
pack('n', $stru << 5 | $aw << 2 | $pos)
You can also throw a bitwise and in there to make sure values can't overflow their bit fields
pack('n', ($stru & 31) << 5 | ($aw & 7) << (2 & 3) | $pos)
I'm guessing it's big-endian, if not use v in pack instead of n