File::Copyinstead of the unportable system call in the old version, actually checks the copy call for success, and has
use strictin place, too. Still not rocket science, but at least it's a bit less dodgy and more portable.
I'm considering replacing the first loop with a map, and maybe playing around a bit more with it. But first I need to tackle some C++ for work.
P.S. Two other things worth pointing out. First, this is exactly the sort of small problem Perl excels at tackling -- quick scripts that make a hard job simple. (That's not to say Perl can't tackle big projects, too!) And second, with the proper switches one can more or less duplicate this program's actions straight from the command line.
P.P.S. The file has been updated to incorporate the
mapidea I had, and autarch's three-arg open suggestion from the comments. Plus I cleaned up the regular expression I used to get the file extension (in retrospect, the old one was dire) and switched from
May try perlcritic next.