in reply to How can one sort array elements in different text files?
In certain environments (e.g. Linux ...) where powerful and well-suited sort commands are available, you should also consider an approach in which you invoke those commands in a simple shell-script-like loop, leaving them to deal with the processing of the actual files and their contents. You are under no obligation to do the sorting within your Perl script, and this might not be the best way to go about doing it. ("Sort commands" do not necessarily employ "memory-based" algorithms; Perl necessarily does. Be sure to very-carefully think outside the box ...)