Jason Frisvold wrote:
> 
> On Wed, 2003-01-08 at 14:52, John W. Krahn wrote:
> >
> > Jason Frisvold wrote:
> > >
> > > 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";
> > > }
> 
> This works great :)
> 
> Still curious what's in that line, but ...
> 
> Is there a way to show the raw output?

Yes, there is:

$Telnet->print( 'sec log sho' );

my @bytes;
while ( my $line = $Telnet->getline( Timeout => 5, ) ) {
    push @bytes, map ord, split //, $line;
    while ( my @group = splice @bytes, 0, 16 ) {
        printf '%02X ' x @group, map { ord } @group;
        print  '   ' x (17 - @group);
        printf '%s' x @group, map { s/[^ -~]/./g; $_ } @group;
        print  "\n";
        }
    }




John
-- 
use Perl;
program
fulfillment

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

Reply via email to