Problems handling variable data

A

apersaud

Ok, so I have a script that uses Net::SSH::perl and Net::SFTP. However
if the filenames to be saved on the remote machine is read from a file
(not set internally in the perl code), it doesn't work.

Example:

use Net::SFTP;
my $sftp = Net::SFTP->new($host, %args);

$val = 'mymachine';
$val2 = `hostname`; #or read from a file on the system
chomp $val2;

$sftp->put('/root/'.$val.'.txt','/root/'.$val.'.txt') # works

$sftp->put('/root/'.$val2.'.txt','/root/'.$val2.'.txt') # FAILS

I get a Wide Character problem with HMAC_SHA1 and no files are copied
over. Anyone has any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top