path names in a PERL-script -

When you use strict; you must declare all variables before use instead of relying on Perl to let you create them on first use, which could hide errors in the program. The quickest fix is to add my in front of the first @allfiles, i.e.

my @allfiles = grep !/^…?$/, readdir THISDIR;