This line in your code seems wrong:
my @lines = grep { -s && "$source/*.log" } readdir ($DIR);
because readdir() returns file names from the given directory handle, and those will never have slashes in them. And because it's just the file name without the directory path, the -s won't work on $_ by itself there.
You may need to show us the line in your script that does the "opendir()" -- you do have such a line, don't you? (readdir won't work unless you do opendir first)
In any case, you probably want something like this:
my @lines = grep { /\.log$/ and -s "$source/$_" } readdir $DIR;
That's assuming that $source is the name of the directory that was passed to the opendir() call (and that the directory handle was the lexically-scoped variable $DIR rather than a bareword "DIR"). |