in reply to Use Schwartzian transform across multiple files

In your program main loop, you still iterate over each file and call sorting. If you want to sort the content of all files, either concatenate all files before starting your program or change your program to first read the content of all files and then sort it, instead of reading and writing a single file. This will mean moving some of the code out of sorting, especially the part where it reads in the whole file, and the part where it writes the sorted file.

Replies are listed 'Best First'.
Re^2: Use Schwartzian transform across multiple files
by Sonya777 (Novice) on Sep 19, 2016 at 12:56 UTC
    Thank you for your quick replay. I cannot use the option to concatenate files as I want to sort the content of all files, one by one, and place the new files (with the same name) to the new folder. This is important because of other steps in my procedure. Therefore I need to first read the content of all files an then sort them. When you say moving some of the code out of sorting, which part excatly are you refering to? I am sorry for the additional question, but I am a newbe in Perl and I still find it hard to understand the syntax. Thanks!