logo       

Re: if loop problem: msg#00417

perl-beginners

Subject: Re: if loop problem

98447122@xxxxxxxxxxxxxx wrote:
Hi All,

I am having a small problem with my if looops. I have
written a small script to parse a file I have

input:

HMU00030 2522 4840 DNA gyrase subunit B
HMU00040 4841 5083 putative membrane protein
HMU00050 5080 5739 c putative periplasmic C39-family
peptidase
HMU00060 5739 6549 c putative inner membrane protein
Wrote a perl script to convert c in fourth column to - and
if not equal to see then +


use strict;
use warnings;

while(<>){
($Gene, $Start, $Stop, $strand, $Product) = split(/\t/,
$_);

my ($Gene, $Start, $Stop, $strand, $Product) = split(/\t/, $_);

if ($strand eq "c"){
print "$Gene\t-\t$Start\t$Stop\t$Product\n";
}else{
print "$Gene\t+\t$Start\t$Stop\t$Product\n";
}
}

unfortunatly output is either all + or all - ?
any ideas?


Check your data. The data you posted had 'c ', that is, a 'c' followed by a space between the tabs.


--
Just my 0.00000002 million dollars worth,
Shawn

Programming is as much about organization and communication
as it is about coding.

My favourite four-letter word is "Done!"

--
To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx
For additional commands, e-mail: beginners-help@xxxxxxxx
http://learn.perl.org/


Google Custom Search

News | Mail Home | sitemap | FAQ | advertise