Thank you to you and the others. The responses have been very helpful.

I am still having trouble with the if() conditionals. Error messages such as "Argument "^C" isn't numeric in numeric eq(==) at (file_name) line (line_num)" suggest that I am both correctly receiving the serial data and that I am correctly "substr"-ing the data. But that leaves me a little confused and lost. As far as I know Perl does not have "int" and "char" data types like the C language. So, since I don't think data types exist (am I wrong?) I don't know of a way to convert data types.

I could try "thinking strings" and use "eq" and hope to find escape sequences for all byte values from 0x00 to 0xff. This seems like a huge amount of work to create a huge failure.

I could use "ord" to convert data to ASCII-HEX digits and do my comparisons to "A", "C", "F3", etc. This seems like it would probably work but it seems like using a bulldozer to move an ant hill.

Any suggestions on both how to write the code and what is going on? My "this is impossible in Perl" response means that this is a good chance to learn something.

Thanks,
Bruce

P.S. Is there a proper term for items such as "F3" that I want to display? I called it ASCII-HEX and one of the kind people responding to my question called them ALPHA. I have had many discussions of this in the past (big number) years. It is not exactly "HEX" since the "F3" is actually 0x46 and 0x33. I sometimes refer to it as the "ASCII text representation of the hex number" but saying that over and over in a planning meeting (or argument) can get old very fast. Actually, it is not exactly representing a hex number since it is really representing a binary pattern of 11110011. ... Kind of trivial until you have to write a document or coordinate the work of several people.


In reply to Re^2: using sprintf to print binary data collected from the serial port by Bruce32903
in thread using sprintf to print binary data collected from the serial port by Bruce32903

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.