hellohello1 has asked for the wisdom of the Perl Monks concerning the following question:
Output that I want:
What I get is :A776 762.81 0.76 1 1 1 1 1 1 1 A872 762.91 1.23 2 2 2 2 2 2 2 . . .
Here's part of my code:A776 762.81 0.76 1 A776 762.81 0.76 1 A776 762.81 0.76 1 A776 762.81 0.76 1 A776 762.81 0.76 1 A776 762.81 0.76 1 A776 762.81 0.76 1 A872 762.91 1.23 2 A872 762.91 1.23 2 A872 762.91 1.23 2 A872 762.91 1.23 2 A872 762.91 1.23 2 A872 762.91 1.23 2 A872 762.91 1.23 2
How do I get $ratio1 to be formatted in tab instead of newline? Advice appreciated!while(my $header_line = <CURINFILE>) { my @headers = split/\s+/, $header_line; push @full_data , [split /\s+/, $_] while (<CURINFILE>); for my $arr_ref1 (@full_data) { for my $arr_ref2(@full_data) { for my $index (3..$#headers) { my $ratio1 = $$arr_ref2[$index]/$$arr_ref1[$index]; # + this is the part where 1 and 2 is outputted. my $ratio = sprintf("%.4f", $ratio1); print OUT1 "$$arr_ref2[0]\t$$arr_ref1[0]\t$$arr_ref2[1]\t$$ar +r_ref2[2]\t\t$ratio1\n"; } } } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Split and join
by kcott (Archbishop) on Mar 07, 2014 at 04:34 UTC | |
by hellohello1 (Sexton) on Mar 07, 2014 at 05:31 UTC | |
by hellohello1 (Sexton) on Mar 07, 2014 at 08:48 UTC | |
Re: Split and join
by davido (Cardinal) on Mar 07, 2014 at 03:12 UTC | |
by hellohello1 (Sexton) on Mar 07, 2014 at 03:21 UTC | |
Re: Split and join
by LanX (Saint) on Mar 07, 2014 at 03:22 UTC | |
by hellohello1 (Sexton) on Mar 07, 2014 at 03:26 UTC |