lyos has asked for the wisdom of the Perl Monks concerning the following question:
The problem is I'm having a hard time understanding what the board is sending back to me because I believe it is being obfuscated by the interpolation of the board's output.
Here's the setup:
Here's the relevant piece of the code:
use strict; use warnings; use Win32::SerialPort; # Open COM port my $COM = Win32::SerialPort->new('COM1') || die("Can't open port."); # Input my $sCommand = "SET INTERFACE NETWORK CLI:0 ENABLE"; $COM->write("$sCommand\r"); $COM->read_interval(100); my $iReadBuffer = length($sCommand); my ($count, $sEcho) = $COM->read($iReadBuffer); # Output print "----------------\n"; print "$sEcho\n"; print "----------------"; undef $COM;
Here's what is printed:
---------------- OK SET INTERFACE NETWORK CLI:0 ----------------
While I'm expecting either:
---------------- ---------------- OK or OK SET INTERFACE NETWORK CLI:0 ---------------- ----------------
The point is I'm unsure exactly what the CLI is sending me. I know that you can print a literal string by defining it with single quotes, but since I'm not the one defining this string (merely grabbing it and sliding it into the $sEcho variable) how do I print the literal, uninterpolated string?
All my searches to this point have returned hits on single qoute printing of literal strings; so thanks in advance for your help!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Printing Literal Contents of a Variable
by roboticus (Chancellor) on Apr 27, 2011 at 18:09 UTC | |
by lyos (Novice) on Apr 28, 2011 at 19:51 UTC |