in reply to Counting files in a folder

You don't convert $file_path from a path to a glob literal. For example, space is special to globs. Does the following work better?
my @files = glob("\Q$file_path\E/*");