RE: How to test result of an extraction?
- From: "Wagner, David --- Senior Programmer Analyst --- WGO"
- Date: Thu, 27 Apr 2006 10:57:16 -0700
Ravi Malghan wrote:
Hi: I am extracting some value from $complete_event asif ( $complete_event =~ /srcIp=(.+) srcPort=/ ) {
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=/;
# 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.
**********************************************************************
.
- Prev by Date: How to test result of an extraction?
- Next by Date: Re: Regular Exression help
- Previous by thread: Reading List (WAS: Chomp method)
- Next by thread: Getopts problem
- Index(es):
Relevant Pages
|