Counting values in a list 2

I know very little about PERL :(

I have list of millions of rows of data. All data values are separated by a comma

I have to count how many rows contain a specific data value

for example


from that sample list, I have to count how many rows have the value 103 for the second data entry, so for this list the number of rows with 103 in the second data entry would be 3

Could someone help me with a PERL script that I can run as a .pl file and will

1. open the file  (filename:  master.vim )
2. Count through all the rows and record the number of rows with the value at that data point - in the second column
3. write the recorded number of rows to another file (  count103.txt  )
4. close master.vim and count.txt

Thankyou very much in advance
Europa MacDonaldChief slayer of dragonsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


open FILE, "<master.vim";
my $count = 0;

while(<FILE>) {
    my @columns = split(',');
    if($columns[1] eq '103') {
close FILE;

open OUT, ">count.txt";
print OUT "$count\n";
close OUT;

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Europa MacDonaldChief slayer of dragonsAuthor Commented:
great thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.