Link to home
Start Free TrialLog in
Avatar of Europa MacDonald
Europa MacDonaldFlag for United Kingdom of Great Britain and Northern Ireland

asked on

List counting in perl

This code counts the number of rows with each new value in column three of my data

#!/usr/bin/perl
use strict;
use warnings;
open M,"<master.vim" or die "master.vim $!";
my %c;

 /^101,(\d+)/ &&  $c{$1}++ while <M>;

close M;
open C,">count.txt" or die "count.txt $!";
print C "$c{$_}\n" for sort{$c{$b}<=>$c{$a}}keys %c;
close C;

Could the code be altered to do the same thing, but for the fourth column ?
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Europa MacDonald

ASKER

great thankyou