hello every one,
i am learning perl scripting here is is a tab delimited file i want to parse
chromosome position1 position2
chromosome position11 position22
chromosome position111 position222
the result i want to have is like that
chromosome position1 position11 (position1-position11 )
chromosome position11 position111 (position11-position111 )
the script i have now is something like this
> open file while $line = <file> {
chomp ;
chromo, pos1, pos2 = split("\t",$line);
$nextline = <file>
chomp;
chromo1, pos11, pos22 = split("\t",$line);
$dif = (pos1 - pos11);
print pos1, pos11 , $dif
line = nextline ;
}
close file;
but the result i got is like
chromosome position1 position11 (position1-position11 )
chromosome position111 position1111 (position111-position1111 )
can anyone help me getting my required result.