A) my $indata = ''; B) while ((my $c = $Tty->read(1)) ne "") { $indata .= ($c); } # here I am bringing in hex chracters one at a time. The unit sends me 0xfc 0x05 0x11 0x27 and 0x56 C) my $payload = extract_payload($indata); # this syas we have 5 bytes total, we strip to the length and strip the 2 byte CRC at the end leaving 0x11 D) my $prtpayload = unpack "H*", $payload; my $prtstatus = unpack "H*", substr($payload,0,1); print "kk: payload=$prtpayload status=$prtstatus "; E) my $status = substr($payload,0,1); # in this case it is the only byte F) $prtstatus = unpack "H*", $status; my $ordstatus = ord($status); print "kk: status2=$prtstatus status3=$ordstatus "; G) if ( $status eq 0x11 ) { print "ok_0x11 "; } else { print "not_0x11 "; } # note that I also used == for the comparison "just in case) and had the same results OUTPUT: kk: payload=11 status=11 kk: status2=11 status3=17 not_0x11