in reply to to print l columnwise and subtraction
Search pattern not terminated at line 12.
As well, wrap input and output in <code> tags as well as source. This is important in this case because you are splitting on tabs, but your post does not contain tab characters. Read How do I post a question effectively?.
I am having a significant amount of difficulty understanding your spec. Assuming your first data are your input and the second are your output, the only filter I can find is that column 5 - column 4 > 217. The following code yields this result:
#!/usr/bin/perl -w #open (FILE,"$ARGV[0]") or die; my @temp =<DATA>; #close FILE; foreach (@temp){ my @t= split("\t",$_); # $t[2],"\n"; if( ($t[4]-$t[3]) > 217 ) { print "$_"; } } __DATA__ aa 22 310 1 300 ab 40 200 2 228 ac 51 230 10 241 df 23 240 22 242 ef 34 370 24 282 gh 24 125 22 210 df 76 290 11 232 wq 13 170 20 180 ss 89 288 12 270
Note this is fairly messy since I tried to use your posted code. I might have written something closer to
#!/usr/bin/perl use strict; use warnings; #open (my $fh, '<', $ARGV[0]) or die "Open failed: $!"; while (<DATA>){ my @values = split /\t/; if( ($values[4]-$values[3]) > 217 ) { print; } } __DATA__ aa 22 310 1 300 ab 40 200 2 228 ac 51 230 10 241 df 23 240 22 242 ef 34 370 24 282 gh 24 125 22 210 df 76 290 11 232 wq 13 170 20 180 ss 89 288 12 270
|
|---|