Hi Chas

sample of the outout from

perl -nle 'print join ", ", map { "[$_]" } split
/\t/'datafile

[HMU09420], [1082913], [1083629], [], [putative
1-acyl-SN-glycerol-3-phosphate acyltransferase]
[HMU09430], [1083645], [1083860], [], [Putative hypothetical
protein]
[HMU09440], [1083903], [1084031], [], [Putative hypothetical
protein]
[HMU09450], [1084175], [1085500], [ c], [putative thiophene
and furan oxidation protein]
[HMU09460], [1085536], [1086201], [ c], [Putative
hypothetical protein]
[HMU09470], [1086198], [1087838], [ c], [putative
inner-membrane protein, OxaA]
[HMU09480], [1087848], [1088201], [ c], [Putative
hypothetical protein]


----- Original Message -----
From: "Chas. Owens" <chas.ow...@gmail.com>
To: 98447...@student.ucc.ie
Cc: "Shawn H. Corey" <shawnhco...@gmail.com>,
beginners@perl.org
Subject: Re: if loop problem
Date: Fri, 31 Jul 2009 10:38:26 -0400

>On Fri, Jul 31, 2009 at 10:19, <98447...@student.ucc.ie>
>> wrote: This is what the file actually looks like. All
>> fileds are separated by tabs
>snip
>
>The following script has visibly correct data and works. 
>This points to your data being the problem.  Try this
>one-liner to see what you data really looks like:
>
>perl -nle 'print join ", ", map { "[$_]" } split /\t/'
>datafile
>
>#!/usr/bin/perl
>
>use strict;
>use warnings;
>
>my $fakefile = <<EOF;
>HMU00030\t2522\t4840\t\tDNA gyrase subunit B
>HMU00040\t4841\t5083\t\tputative membrane protein
>HMU00050\t5080\t5739\tc\tputative periplasmic C39-family
>peptidase HMU00060\t5739\t6549\tc\tputative inner membrane
>protein EOF
>
>open my $fh, "<", \$fakefile
>    or die "could note create a fake file: $!";
>
>while(<$fh>){
>    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";
>    }
>}
>
>-- 
>Chas. Owens
>wonkden.net
>The most important skill a programmer can have is the
>ability to read.
>
>-- 
>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/


Reply via email to