SSL connections provide several ways to restrict the acceptable certificate values that are presented, although these features are not commonly used in the Wooly Wild Internet. Connection verification should be done at a protocol level. Man-in-the-middle attacks should be prevented thereby. If you trust the server you’re talking to, or the client you’re listening to, then HTTPS will transfer the bytes correctly.
Another way to do it on a more general scale is to use VPN with individually-issued digital certificates.
“Trust,” however, can be a big question, because, in the case of a data file, you must trust the file not the transport. “Even if the message is being delivered by carrier pigeon, you must be able to trust the message, not the bird.” If you return to the message weeks or months after delivery, you must still be able to authenticate its content. The only way to do that is with a cryptographically signed file. Tools like gpg can do that, whether or not the message itself is encrypted. Your entire company workflow, not just this Perl program, must support that in order for it to be meaningful.