Don't get too worried over the less obvious bits of the file handling stuff. Perl lets you use a variable as a file by using a reference to it in the open:
my $stringBeingAFile = "This is the contents of the stringy file\n";
open my $inFile, '<', \$stringBeingAFile;
which I use in the sample script to avoid having to create temporary files for demonstration purposes. In the current case it's slightly more complicated because you want to deal with multiple files so I use a hash that is pretending to be a directory of files (really a hash of file name => file content pairs).
But, as I suggested, you needn't worry about that so long as you can see past the first 36 lines and ignore the "use a string as a file" syntax in the opens the remainder of the code is the important bit.
True laziness is hard work
|