in reply to how to write perl scripts with below requirements

G'day spatil20,

Welcome to the Monastery.

Firstly, PerlMonks does not provide a code writing service. We're happy to help with problems and answer questions about code you've written; however, we don't write your code for you. "How (Not) To Ask A Question" has more details about this (the negative what not to do). "How do I post a question effectively?" is the positive side of this coin, i.e. what you should do.

Without knowing your level of Perl, I'll point you to "perlintro - Perl Introduction for Beginners". This is very basic but each section has links to further details and advanced topics — I'll leave you to determine where the holes in your Perl knowledge lie and which links are appropriate for you.

Your code and data should be marked up within <code>...</code> tags. What you've posted is not that easy to read but part of it appears to be (pipe-separated) CSV: I strongly recommend you use the Text::CSV module for dealing with this.

When you've written some code, feel free to return and ask questions about it, if need be.

— Ken