>perl -wMstrict -le "my $SM = 0xfe; my @ADRDSTN = (0x00, 0x09, 0x01, 0x00); my $MID = 0x01; my $MDLH = 0x00; my $MDLL = 0x18; my $EM = 0xFD; ;; my @message = (@ADRDSTN, $MID, $MDLH, $MDLL); ;; my $packed_message = pack 'C*', @message; ;; my $checksum = 256 - unpack '%8C*', $packed_message; ;; my $msg_for_socket = pack 'C a* C C', $SM, $packed_message, $checksum, $EM; ;; my $msg_for_debug = unpack 'H*', $msg_for_socket; print qq{'$msg_for_debug'}; " 'fe00090100010018ddfd'