It doesn't take three screenfulls of code to demonstrate a problem with -s. Furthermore, it appears that you didn't even show the code that fails! I'm just going to offer a couple of general tips.
First, what exactly does -s return. If it's zero, that means it thinks the file exists and that it's empty. But I suspect it's returning undef, in which case $! contains an error message. Is -s returning undef, and it so, what's $!?
my $size = -s "/home/vcg/Documents/Trial/temp"; die("-s: $!") if !defined($size); if ($size) {
A common mistake is to pass paths with trailing spaces or newlines. Or improper escaping of \. Make sure the variable contains what you think it does.
In reply to Re: -s testing for empty file; works on local, but not on remote
by ikegami
in thread -s testing for empty file; works on local, but not on remote
by Jeri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |