How to test result of an extraction?



Hi: I am extracting some value from $complete_event as
follows. What can I check to see if the extraction
returned a valid value? "if($_)" seems to be giving
incorrect values. In the following statement, $srcIp
is being set to an old extracted value if there is no
valid value following srcIP in my $complete_string
instead of 0.

$complete_event =~ /srcIp=(.+) srcPort=/;
if($_) {$srcIp = $1;}
else {$srcIp = 0;}

Thanks
Ravi

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
.



Relevant Pages