in reply to Why is the following instance of Matching using an array element not working
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why is the following instance of Matching using an array element not working
by MyJeweledPerls (Initiate) on Aug 10, 2012 at 19:33 UTC | |
by Kenosis (Priest) on Aug 10, 2012 at 20:31 UTC | |
by MyJeweledPerls (Initiate) on Aug 10, 2012 at 23:03 UTC | |
by Kenosis (Priest) on Aug 11, 2012 at 05:53 UTC | |
by MyJeweledPerls (Initiate) on Aug 13, 2012 at 21:22 UTC | |
|