How to force syswrite to write numbers? A number is a numerical value; I do not mean the squiggly lines we draw to represent numbers.
Perl keeps changing the values I try to write, in accordance with its 'does what you expect it to do' philosophy. Three days of official and unofficial documentation, I can't find a solution.
Some examples of Perl changing types behind my back: with this line: syswrite($SERIALPORT, $packet_out)
When I say syswrite 4, I want a number 4 to go out the wire. This must be possible, and discussed already; anyone know how or where? I open the port like this:$packet_out = 4; On the serial wire: 0x34 (which is ASCII code for character 4) $packet_out = '4'; On the serial wire: 0x34 (which is ASCII code for character 4) $packet_out = 0x65; On the serial wire: 0x31 0x30 0x31 (which, bizarrely, is ASCII code fo +r '101' which is a string of the decimal ASCII code for 'e' which has + the ASCII code 0x65)
unless (open ($SERIALPORT, "+<", $comport)) {die "Cannot open $comport +: $!"} system("stty -cstopb hupcl ignbrk -iexten -echo -echoe -echok " . "-echoctl -echoke -crtscts -ignpar cs8 9600 time 5 -icrnl " . "-ixon -opost -isig -icanon -F $comport"); die unless binmode($SERIALPORT, ':raw:bytes'); #numerous variations tr +ied
In reply to syswrite numbers, not strings by akujbida
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |