in reply to Re^3: invoke shell with `` failed
in thread invoke shell with `` failed

After some experimentation, I've managed to duplicate this error message -- but (on my system) it only happens when $dir is more than about two megabytes long! Are you sure $dir never changes?

The error is coming from the operating system; it can't be trapped with eval like I'd expected. However, you can determine whether the command succeeded by checking $?, which will be 0 if it worked and something else if it didn't. So I suggest what you do is change your code slightly:

my $available_space = `df $dir`; if ($? != 0) { warn "df failed: command was `df $dir`"; }

(and the equivalent in the other place where you use ``).

That should tell you exactly what is being considered "too long".