in reply to HOW to calculate the column data

Hmm, smells like homework …. What have you tried? Perl newbies become Perlmonks by experimenting.

As a hint, you might want to try populating a hash, using split to get your hands on the proper keys and values.