I can't reproduce the error on my system (and it seems very similar to yours: perl 5.8.8 on Debian). Please, post again the full source code for your script, the command line you are using to run it and its exact output.
CPAN::Forum
Net-SFTP-Foreign - Re: 64-bit code won't compile and can't connect to sftp server