in reply to Access given folder to parse a file

$file is a scalar variable, possibly a file path. Why do you assign a list to it?
my $files = ($directory, "\", $file);

It might be better to concatenate the strings:

my $file_path = $directory . '\\' . $file; # OR my $file_path = "$directory\\$file";

Note that \ is special, to include it literally, you have to backslash it.

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ