Jason Frisvold wrote:
> 
> Hi all,

Hello,

>         I'm using the Net::Telnet module to automate some of the more menial
> tasks I have to deal with every so often.  Part of the task requires
> parsing a stream of data from the device I'm telnetting to (A Marconi
> ASX-200 to be exact) ...  I've successfully set up the telnet, logged
> in, and executed the proper commands.  Now, however, I need to retrieve
> data from the device.  I can submit the command and use getline() to
> retrieve lines, one at a time, and parse it.  However, there are
> "hidden" characters here and I don't know how to determine what they
> are.
> 
> Here is a quick snippet of the code :
> 
> $Telnet->print("sec log sho");
> while (my $line = $Telnet->getline(Timeout => 5,)) {
>         chomp $line;

Instead of chomp (because this will remove newlines as well) use this:

        # remove every character NOT in the range ' ' to '~' inclusive
        $line =~ s/[^ -~]+//g;


>         print "--->>>>$line<<<<---\n";
> }



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to