in reply to How to store a bigger number in 1 byte

$dataIn[20] = pack "C", $var & 0xFF; $dataIn[21] = pack "C", $var >> 8;
But those aren't really bytes, as Perl doesn't have 'bytes' as a native type. Instead, you get strings, each representing a byte.

Replies are listed 'Best First'.
Re^2: How to store a bigger number in 1 byte
by salva (Canon) on Apr 27, 2005 at 15:16 UTC
    or also using pack:
    @dataIn[20, 21] = unpack(CC => pack(n => $var));