in reply to $sftp->binary failing

The transfer mode (text or binary) is a feature of FTP that doesn't have an equivalent on SFTP (mostly because the transformation can be done on the client side).

Just remove the binary call from your code.