I don'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> <<a href="mailto:jay@jays.net">jay@jays.net
</a>> 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>> Could you please take a look at this.
<br>> <test.zip><br><br>Hi again Kiran. :)<br><br><br>Your code (as viewed in the debugger):<br><br><br> DB<6> l 9-15<br>9: while (my $line=<IN1>)<br>10 {<br>11: if ($line=~ m/\>\s+/)
<br>12 {<br>13: $line=~ m/^(\S+)\>\s(\S+)$/;<br>14==> my $read = $1;<br>15: 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'll step past the regex and show you the newlines:<br><br><br> main::(test.pl:<br>13): $line=~ m/^(\S+)\>\s(\S+)$/;
<br><br>DB<1> n<br>main::(test.pl:14): my $read = $1;<br><br><br><br><br><br> DB<3> p "[$line]"<br>[a> APPLE<br>]<br><br><br>Now normally you could just 'chomp $line;', but that didn'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't working, so I x'd it in the debugger to see why not:<br><br>
<br> DB<3> x $line<br>0 "a> APPLE\cM"<br><br><br>Bummer. I believe "\r\n" (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> $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, <IN1>
<br>line 5.<br><br><br>Which you can avoid by NOT running look_up_order() if there is no<br>$value. I don't know if that's what you wanted to do or not, but you<br>can do that with this line<br><br><br> next unless ($value); # No value in file...
<br><br><br>So your code now reads like this:<br><br><br>while (my $line=<IN1>)<br>{<br> $line =~ s/[\r\n]//g;<br> if ($line=~ m/\>\s+/)<br> {<br> $line=~ m/^(\S+)\>\s(\S+)$/;<br> my $read = $1;
<br> my $value= $2;<br> next unless ($value); # 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't seem to do anything at all. Were
<br>you wanting it to pull values out of File2 if File1 didn'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>