in reply to concatenating text files before reading

You could also do it on the command line:

cat *.txt | perl myscript.pl