in reply to $sftp->binary failing

Neither Net::SFTP nor Net::SFTP::Foreign have a documented "binary" method.

(Perhaps you expected them to, because Net::FTP does.)

Net::SFTP::Foreign allows you to pass a reference to a file handle in the "put" method.

It is possible to open this file handle and "binmode" it, prior to passing it in - this will probably accomplish what you are attempting.

        Profanity is the one language all programmers know best.