It looks like your iterating over lines from Errors-email.txt (and it would have helped to see some of these lines, since they contain the IDs):
... open (ERRORFILE,"<", "Errors-email.txt") || die "File not found\n"; @error_array = <ERRORFILE>; ... foreach my $line(@error_array){ # # Some $line substitutions here... ... push(@sample_ids,$line); ...
Then you have the following:
... foreach my $records(@merged_array){ if($records =~ /$sample_ids[3]/){ ...
Where @merged_array contains lines from your cvs file.
Does @sample_ids contain only the IDs? Did you try printing $sample_ids[3] to see what you get? Since you successfully used UCD67832 in the regex, it's evident that $sample_ids[3] does not equal UCD67832. What does it equal? Is UCD67832 a different element of @sample_ids? Does @sample_ids comtain whole lines instead of IDs?
I can't see that you've actually isolated the ID (unless it's via the set of substitutions), so I'd tend to focus on grabbing the ID from $line around those substitutions, and then push(@sample_ids,$id);
Hope this helps!
In reply to Re: Why is the following instance of Matching using an array element not working
by Kenosis
in thread Why is the following instance of Matching using an array element not working
by MyJeweledPerls
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |