Greetings listers,

I have the following code snippet:

my @result;
@result =`ping $hostname`;
my $aPing = @result;
my $Pcount = 0;
$Status = $entryS->Entry->delete("1.0", "end");
while ($aPing > 0){
print  DUMPFILE "* @result[$Pcount]";
if ( substr(@result[$Pcount],0, 12) == '    Packets:' ) {
     $Status = @result[$Pcount];
     $entryS->Entry->Insert(0,$Status);
     $entryS->update;
     }
$Pcount++;
$aPing --;
}

The problem is that I get ALL lines of the returned Ping status, in the 
IF statment...

For example, if I ping www.cisco.com,

here is what $STATUS will end up reporting:
--
Pinging www.cisco.com [198.133.219.25] with 32 bytes of data:

Reply from 198.133.219.25: bytes=32 time=110ms TTL=241
Reply from 198.133.219.25: bytes=32 time=111ms TTL=241
Reply from 198.133.219.25: bytes=32 time=110ms TTL=241
Reply from 198.133.219.25: bytes=32 time=110ms TTL=241

Ping statistics for 198.133.219.25:
     Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
     Minimum = 110ms, Maximum =  111ms, Average =  110ms
--
I only want to display (In the Tk::Entry field) the:
'Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),'

How come my if statement is failing?

What mistake did I make?

TIA!

Chris


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

Reply via email to