The Module FindBin gives you a variable called $FindBin::Bin which points to the path where the executed perlscript is; if you need a relative path like my $file = "./files/file.txt";, you can easily write instead:
use FindBin;
my $file = "$FindBin::Bin/files/file.txt";