assembling a signed integer from bytes

Discussion in 'Perl Misc' started by Steve, Jan 8, 2005.

  1. Steve

    Steve Guest

    Hi all

    I am reading data from a serial device with perl, capturing each group
    as an array of numbers generated from the ord of each character. I
    don't know exactly how it is formatted, but having looked at the way
    the values vary and knowing the type of data being transmitted, it
    seems likely that I have several signed numbers each compsed of two of
    my bytes.

    How do I assemble two variables, each carrying a number 0-255 into a
    single, two-byte signed number?

    Thanks

    Simon
     
    Steve, Jan 8, 2005
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rogue Chameleon
    Replies:
    6
    Views:
    484
  2. Malte

    jar assembling tool ...?

    Malte, Apr 23, 2005, in forum: Java
    Replies:
    9
    Views:
    976
    JScoobyCed
    Apr 25, 2005
  3. Andy Dingley

    Assembling composite DTDs

    Andy Dingley, Jun 2, 2006, in forum: XML
    Replies:
    5
    Views:
    601
    Henri Sivonen
    Jun 3, 2006
  4. Replies:
    14
    Views:
    2,589
    CBFalconer
    Jun 18, 2005
  5. kyrpa83
    Replies:
    1
    Views:
    840
    kyrpa83
    Oct 17, 2007
  6. Replies:
    9
    Views:
    379
    Jack Klein
    Feb 1, 2008
  7. Rob1bureau
    Replies:
    1
    Views:
    998
    joris
    Feb 27, 2010
  8. w wg
    Replies:
    7
    Views:
    406
Loading...