in reply to Text merge concept in perl

You'll have to define "merge". Without any particular algorithm this could be as simple as

cat *.txt > outfile