I don&#39;t know if i did not formulate the problem right. This is what I wanted.<br>The GI- number in File2 is a smaller subset of possible GI-in File 1 (This has the matching GI plus the sequence I am interested in). <br>
(Or. I want to pull all the sequences from file-1 using the GI listed in File 2)<br>kiran<br><br><div><span class="gmail_quote">On 1/19/07, <b class="gmail_sendername">Jay Hannah</b> &lt;<a href="mailto:jay@jays.net">jay@jays.net
</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On Jan 19, 2007, at 7:18 AM, kiran bina wrote:<br>&gt; Could you please take a look at this.
<br>&gt; &lt;test.zip&gt;<br><br>Hi again Kiran.&nbsp;&nbsp;:)<br><br><br>Your code (as viewed in the debugger):<br><br><br>&nbsp;&nbsp; DB&lt;6&gt; l 9-15<br>9:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while (my $line=&lt;IN1&gt;)<br>10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>11:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($line=~ m/\&gt;\s+/)
<br>12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>13:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $line=~ m/^(\S+)\&gt;\s(\S+)$/;<br>14==&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $read = $1;<br>15:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $value= $2;<br><br><br>Your first problem is that $line has carriage returns and/or newlines<br>
at the end, so your regex demand that the line end with \S+ fails.<br><br>I&#39;ll step past the regex and show you the newlines:<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;main::(test.pl:<br>13):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $line=~ m/^(\S+)\&gt;\s(\S+)$/;
<br><br>DB&lt;1&gt; n<br>main::(test.pl:14):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $read = $1;<br><br><br><br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DB&lt;3&gt; p &quot;[$line]&quot;<br>[a&gt; APPLE<br>]<br><br><br>Now normally you could just &#39;chomp $line;&#39;, but that didn&#39;t work for
<br>me on your data. Perhaps because my Mac defines newlines differently<br>than wherever you made your file? Even after I added chomp it still<br>wasn&#39;t working, so I x&#39;d it in the debugger to see why not:<br><br>
<br>&nbsp;&nbsp; DB&lt;3&gt; x $line<br>0&nbsp;&nbsp;&quot;a&gt; APPLE\cM&quot;<br><br><br>Bummer. I believe &quot;\r\n&quot; (carriage return, linefeed) is interpreted<br>as Control-M, So I added a regex to remove all carriage returns and<br>
linefeeds<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp; $line =~ s/[\r\n]//g;<br><br><br>(chomp might work fine for you.)<br><br>The next annoyance was all these warnings:<br><br><br>Use of uninitialized value in string eq at test.pl line 43, &lt;IN1&gt;
<br>line 5.<br><br><br>Which you can avoid by NOT running look_up_order() if there is no<br>$value. I don&#39;t know if that&#39;s what you wanted to do or not, but you<br>can do that with this line<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; next unless ($value);&nbsp;&nbsp;#&nbsp;&nbsp;No value in file...
<br><br><br>So your code now reads like this:<br><br><br>while (my $line=&lt;IN1&gt;)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp; $line =~ s/[\r\n]//g;<br>&nbsp;&nbsp;&nbsp;&nbsp; if ($line=~ m/\&gt;\s+/)<br>&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $line=~ m/^(\S+)\&gt;\s(\S+)$/;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $read = $1;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $value= $2;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; next unless ($value);&nbsp;&nbsp;#&nbsp;&nbsp;No value in file...<br><br><br>which seems to work?<br><br><br>$ perl test.pl<br>a<br>APPLE<br>b<br>BOY<br>d<br>DOG<br><br><br>?<br><br>Lower, your look_up_order() doesn&#39;t seem to do anything at all. Were
<br>you wanting it to pull values out of File2 if File1 didn&#39;t have a<br>$value or something?<br><br>HTH,<br><br>j<br><br><br>_______________________________________________<br>Omaha-pm mailing list<br><a href="mailto:Omaha-pm@pm.org">
Omaha-pm@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/omaha-pm">http://mail.pm.org/mailman/listinfo/omaha-pm</a><br></blockquote></div><br><br clear="all"><br>-- <br>Dhundy R. Bastola<br>Assistant Professor<br>
Department of Pediatrics<br>University of Nebraska Medical Center<br>Omaha NE 68198<br>Always reply to: <a href="mailto:dbastola@unmc.edu">dbastola@unmc.edu</a><br>