Bitten by regular expression syntax.
next if $FILE =~ /^./;
Should be:
next if $FILE =~ /^\./;
In your match you were looking for each filename starting with, not a 'dot', but any single character. Naturally everything matched. Easily done.
Update:
Turns out you have a few other issues. As
Corian says, you need to prefix $FILE with the directory name. There is another issue as well - for some reason you require a reference to an array to be passed to your subroutine (why?). Here are the relevant lines modified:
if(-d "$FILEPATH/$FILE"){
#Don't wanna have current directory and the one below
next if $FILE =~ /^\./;
push(@FILELIST,@{readin_directory(["$FILEPATH/$FILE"])}
+);
}
I have not tested this on a wide range of naming conventions. Notice that the argument to the subroutine call (& not required) is in square brackets, to generate a ref to an array.