in reply to Terminal Client

I'd use Net::Telnet, but if I were to do it myself, I'd use pack:
$MySocket->send(pack "H*", "02")
should do the trick. Note that with the "H*" format given to pack, you can use a long string. pack "H*", "02020d0a" encodes STX STX CR NL.

If it's just a single byte, I'd use:

$MySocket->send("\x02")

Replies are listed 'Best First'.
Re^2: Terminal Client
by cstrong (Beadle) on Oct 24, 2008 at 15:31 UTC
    Thanks to everyone for the fast responses.

    The trick I was missing was to send the data as octal as per your suggestions. So for example if I use
    $MySocket->send("\02\8\03");
    The receiving end sees this as hex "02 38 03" (STX 8 ETX). Which is exactly correct. I can use the octal conversion functions as suggested by you guys to convert string "en mass".

    Many thanks for everyones help!
      \8 isn't valid octal. The result is a warning, and sending hex value 38. This just happens what you want, but \7 sends hex value 7. You don't want the \ in front of characters you want to send as they appear.