my $mi = pack( 'LLLILLL', 12 * 4, MIM_BACKGROUND, 0, 0, $po, # <=== problem might be here 0, 0, ); #### my $mi = pack( 'LLLILLL', 12 * 4, MIM_BACKGROUND, 0, 0, $po->{-handle}, # <=== change to this 0, 0, );