in reply to Perl File-Test Operators

Instead of running ls in a separate process you should use Perl's built-in glob operator:
foreach my $logfile ( <$path/$file> ) {