When Perl sees \' in a string literal, it places just ' in the string, so you haven't changed anything.
You seem to have missed half of my comment.
I didn't suggest that you escape the 1st and 2nd ' with \.
I didn't suggest that you escape all the ' with \.
I suggested that you escape the 2nd and 3rd ' with \\.
$FileTime = `ssh $ServerName 'perl -e \\'(stat($FP_RemoteFile))[9];\\''`;
executes
ssh $ServerName 'perl -e \'(stat(...))[9];\''
which executes
perl -e '(stat(...))[9];'
on the remote machine if sh behaves as I think it does.
Update: stat($FP_RemoteFile) is also wrong. You need to convert the contents of $FP_RemoteFile into a Perl literal, then you must escape it for sh.
In reply to Re^3: Comparing localtime to a remote file's modification time.
by ikegami
in thread Comparing localtime to a remote file's modification time.
by baerlun
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |