in reply to Re^3: Split a column
in thread ead a file which has three columns and store the content in a hash
Now i am counting the values in the third column i.e how many up words how many down words and how many NA. For that i wrote the following program:
it is doing a great job but when i add a same row in the last of the file it doesn't count its up, down or NA word. why is that?@values = values(%hash); for $element (@values){ if ($element =~ /up/){ $sumA++; }if(($element =~ /down/)){ $sumB++ }if(($element =~ /NA/)){ $sumC++ } } print "Number of up is: $sumA\n"; print "Number of down is: $sumB\n"; print "Number of NA is: $sumC\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Split a column
by Fletch (Bishop) on Apr 13, 2020 at 18:03 UTC | |
Re^5: Split a column
by choroba (Cardinal) on Apr 13, 2020 at 18:00 UTC | |
Re^5: Split a column
by AnomalousMonk (Archbishop) on Apr 13, 2020 at 18:44 UTC |