Kindly help me to write a perl programme in this regard.
- Construct a detailed specification of the problem.
- Design an algorithm to fit the specification.
- Write Perl code to implement the algorithm.
- Write a test suite against the specification to prove that it has been met. (Once you become more proficient at this it is advisable to write the tests before the implementation.)
- Document everything.
Use strict and warnings always. Read perlintro for the basics and then the other relevant parts of the documentation. Post back here with details if/when you get stuck.
Happy landings!