This is a code designed in perl to do the following tasks: