This is what the file actually looks like. All fileds are separated by tabs
Gene Start Stop strand Product HMU00010 1 1290 chromosomal replication initiator protein HMU00020 1448 2512 DNA polymerase III, beta chain 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 (pseudogene) HMU00070 6592 7353 c putative secreted protein HMU00080 7375 7617 c putative membrane protein HMU00090 8072 9076 c UDP-glucose 4-epimerase ----- Original Message ----- From: "Shawn H. Corey" <shawnhco...@gmail.com> To: 98447...@student.ucc.ie Cc: beginners@perl.org Subject: Re: if loop problem Date: Fri, 31 Jul 2009 09:39:08 -0400 >98447...@student.ucc.ie 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-unsubscr...@perl.org >For additional commands, e-mail: beginners-h...@perl.org >http://learn.perl.org/ > > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/