RE: How to test result of an extraction?



Ravi Malghan wrote:
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 ( $complete_event =~ /srcIp=(.+) srcPort=/ ) {
# true
}
else {
# false
}
Wags ;)
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


**********************************************************************
This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited.
**********************************************************************

.



Relevant Pages

  • How to test result of an extraction?
    ... I am extracting some value from $complete_event as ... In the following statement, $srcIp ... Do You Yahoo!? ... Mail has the best spam protection around ...
    (perl.beginners)
  • Re: How to test result of an extraction?
    ... Ravi Malghan am Donnerstag, 27. ... What can I check to see if the extraction ... look at perldoc perlvar for the meaning of the $_ var. ... valid value following srcIP in my $complete_string ...
    (perl.beginners)
  • Tar extraction Error
    ... Tape Extraction errors on sun. ... User had tar'd a 4GB of data file onto a 8mm tape. ... Do you Yahoo!? ...
    (SunManagers)