in reply to Re: list lines not found in config (while+if)
in thread list lines not found in config (while+if)
Taking your sample data and original code I've generated the following sample code. Note that I added strictures and cleaned up a few other aspects of you code. I also removed the first line of your reference file so that at least one "missing" line would be reported.
use strict; use warnings; my $File1 = <<END_FILE1; GP_MASA_38C02_c GP_MASA_33B06_c GP_MASA_24D04_c GP_MASA_35A04_c END_FILE1 my $File2 = <<END_FILE2; 'GP_MASA_01F04_c',681,'ACCACACATCATCTGACTTACGTACGTACG...... 'GP_MASA_38C02_c',273,'ACATCCTTCACAGAAGTTTGT............. 'GP_MASA_33B06_c',288,'ACATACTAACACGGTCTTT............... END_FILE2 my $match = 0; open my $dataIn, '<', \$File2; while (<$dataIn>) { chomp ($_); my $dataLine = $_; open my $refIn, '<', \$File1; while (<$refIn>) { chomp ($_); my $str = $_; if ($dataLine =~ /$str/) { $match = 1; } } close ($refIn); if ($match == 0) { print "$dataLine\n"; } $match = 0; }
Prints:
'GP_MASA_01F04_c',681,'ACCACACATCATCTGACTTACGTACGTACG......
Although reparsing the reference file for each line of the data file is exceedingly nasty, the code works. Maybe you can update the sample to demonstrate where you are seeing a problem?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: list lines not found in config (while+if)
by tangledupinperl (Initiate) on Apr 08, 2009 at 11:19 UTC |