in reply to concatenating text files before reading

The diamond operator has a bit of magic that could help. When used with an empty filehandle, it will read lines from all files in @ARGV. So you just have to put your input file list in @ARGV, and read it all with a while loop. And glob is your friend too.

local @ARGV = glob "folder/*.txt; # list of all .txt files in folder print while (<>); # print each line of all those files

Replies are listed 'Best First'.
Re^2: concatenating text files before reading
by Hossein (Acolyte) on Sep 05, 2013 at 09:19 UTC
    Thank you :)

    this was what I was looking for.

    regards

    Hossein

        The while (<>) can be tricky when used with initial @ARGV (script parameters), but in this case, as @ARGV is the result of a glob, most of these problems are avoided. There is however something you should check: that @ARGV is not empty after the glob operation, or <> will read in the standard input. localising the change to @ARGV could avoid some trouble as well.

        There's also taint mode to play it more secure.