Trina Espinoza wrote:
Var $machine_status contains this block of data:

machine_status = "Pinging 129.111.3.79 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.111.3.79:
   Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
Approximate round trip times in milli-seconds:
   Minimum = 0ms, Maximum =  0ms, Average =  0ms"

I am trying to do a regular expression to see if the block contains the string "Request timed out." from the block. My regular expression is below, but it fails to find the string "Request timed out." What am I doing wrong?

if ($machine_status =~ /^Request timed out.$/m) {

It looks like there are spaces at the end of those lines. Also the . character is special in regular expressions so you have to escape it.


if ($machine_status =~ /^Request timed out\. *$/m) {



John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to