Well, assuming you have fixed length data so that you know YES occurs at index 25 in the string given, I'll use my PSI::ESP module and guess that you've read in lines of data into an array (@arr), and that the YES string is supposed to occur at the end of that line and you haven't chomped the newline off the end of the line -- thus you are trying to compare "YES\n" eq "YES". If this guess sounds right, try doing a chomp $contact_me; prior to your inner conditional test as in:
#!/usr/bin/perl -w use strict; my @arr = <DATA>; my $contact_me_count = 0; for my $lcv (0 .. $#arr){ if($arr[$lcv] =~ /^CONTACT_ME:/){ my $contact_me = substr("$arr[$lcv]", 25); chomp $contact_me; if($contact_me eq 'YES'){ $contact_me_count ++; } } } print $contact_me_count; __DATA__ CONTACT_ME: YES CONTACT_ME: NO
In reply to Re: Head to numb to see it.....
by danger
in thread Head to numb to see it.....
by Fian
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |