|
I was having the same problem when sending a User Password that was taken from the command line.
The following code worked for me:
use utf8;
# .. MORE CODE HERE ..
# GET USER PASSWORD
print "\nPassword for $UserName\n";
system('stty', '-echo') == 0 or die "can't turn off echo: $?";
my $UserPassword = <STDIN>;
system('stty', 'echo') == 0 or die "can't turn on echo: $?";
chomp $UserPassword; # Remove newline character
# Convert to utf8 to avoid problem with DES.pm module
utf8::encode ($UserPassword);
# THE SFTP CONNECTION THEN WORKS AS
$sftp = Net::SFTP->new( $IndTarget,
user=> $UserName,
password=> $UserPassword,
debug=>"true");
|