Hi monkers,
Iam back with a struggle trying to subtract elements from two columns and different rows in a array. I have my TSV file as input that has two of my columns. and want to subtract the 0th value of my 2nd column with the 1st value of the 1st column. then again go on subtracting this this way till the end of the column. I tried to put the data into two array and applied the subtraction operator but i am getting error as "use of uninitialized value in subtraction" and there is no output in my file but the size has increased. The code i used is below, and i have no idea where i went wrong! please help.
open (FILE, 'probe_dist.tsv');
open (OFILE,'>probe_sum.tsv');
while (<FILE>)
{
my @a;
my @b;
($a,$b)=split ("\t");
$a=@a;
$b=@b;
my $c;
my $d;
my $c=1;
my $d=0;
my $e=$b[$d]-$a[$c];
$c++;
$d++;
print OFILE "$e\n";
}
my input file looks like this
4775792 4775851
4775842 4775901
4775852 4775911
4775902 4775961
4775952 4776011
4776002 4776061
4776052 4776111
4776102 4776161
4776212 4776271
4776252 4776311
4776302 4776361
4776352 4776411
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.