Curt Shaffer wrote:
>>
>>
>> Uri> post the output line from that command. do not let your emailer mung it
>> or word wrap it. show the part you want to extract out. there may be
>> easier ways to get it with a regex and not with split.
>
> I think you may be right. I would like to pull the numerics out from the id=
> section.
>
> Sample output:
>
> #begin code output
Using the first example (forgive the wrap):
my $ping_result = "HPING www.microsoft.com (en1 207.46.19.190): S set,
40 headers + 0 data bytes len=46 ip=207.46.19.190 ttl=64 DF id=21409
sport=80 flags=SA seq=0 win=5840 rtt=102.8 ms";
> # As seen above, what I am looking for is pulling the id= field
$ping_result =~ m{ .* id=(\d+) }xms;
my $ping_id = $1;
print "$ping_id\n";
% ./id.pl
21409
Steve
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/