# (inside ncurses listbox callback) my $listbox = shift; my @sel = $listbox->id; $byte2 = 0; $byte1 = 0; if (@sel) { my $code; $code |= 1 << $_ for @sel; $byte2 = $code >> 8; $byte1 = $code & 0xFF; }