in reply to Bash script to perl script

Well, we'd need to see a chunk of the input file, and an example of what your expected output looks like. Put both of those in <code></code> tags like you've put your Bash code in.

Also, no matter what it looks like, please show the Perl code that you've made an attempt with, so the Monks can see that you have made at least an attempt.