in reply to Text merge concept in perl

Everything you need to know is in the Tutorials section.

If you get stuck with a particular point of your code, do ask again.

EDIT: of particular use might by readdir, open, and perlsyn.