readdir returns file names, not paths, so -z could be failing to find the (right) file to check.
By the way, it would be faster to check -z second (since it requires an io call), and it would be better to avoid needless captures.
opendir(my $dh, $dir) or die("opendir: $!\n"); my @files = grep { ( !/\.(?:txt|prn|csv)\z/ && /$SrcPattern/ ) || -z } map "$dir/$_", readdir($dh);
In reply to Re: filter empty files
by ikegami
in thread filter empty files
by sri1230
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |