in reply to Head to numb to see it.....
When you're running into troubles like this, you should try to get some debugging info; for example, print out the value of $contact_me to make sure you're getting the part of the string you want (i.e. is that inner condition ever met?).
Assuming that part is working correctly, I think azatoth has a plausible suggestion about what might be wrong (that space).
This may not make much sense with the data you're working with, but let me make a suggestion: you appear to have the location of the "YES" hard-coded into $arr[$lcv], which is pretty inflexible. If you can, you might change that and use a regular expression solution (update e.g. $contact_me_count++ if ($arr[$lcv] =~/^CONTACT_ME:.*\bYES\b/); -- change the \b at the end to $ if the YES is at the end of the string)).
Here's a slightly more succinct way of doing it, given what you've written:
if ($arr[$lcv] =~/^CONTACT_ME"/ and substr ($arr[$lcv], 25) eq 'YES')) + { $contact_me_count++; }
Of course, perl allows you to say STATEMENT if EXPRESSION, if that floats your boat ( 3 lines into 1 ... who wouldn't like that?) =)
Philosophy can be made out of anything. Or less -- Jerry A. Fodor
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (arturo) Re: Head to numb to see it.....
by Fian (Novice) on Mar 14, 2001 at 19:51 UTC |