in reply to Printing Literal Contents of a Variable
lyos:
I'd suggest looking at the bytes coming in from the serial port. You can do it in many ways, one of which is:
$sEcho =~ s/([\x00-\x1f\x7f-\xff])/sprintf("\\%02x",ord($1))/ge;A complete example:
#!/usr/bin/perl use strict; use warnings; my $t = join("", map { chr($_) } 0 .. 255); $t =~ s/([\x00-\x1F\x7F-\xFF])/sprintf("\\%02x",ord($1))/ge; print $t;
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Printing Literal Contents of a Variable
by lyos (Novice) on Apr 28, 2011 at 19:51 UTC |