I try to write variable in end of file, but write it into STDOUT in local server some code:
$num = <STDIN>
my $cmd = "echo $dep_keys{$num} >> /root/1";
#$ssh->system({stdin_data =>$dep_keys{$num} },"echo >> /root/1");
#$ssh->error die "Couldn't establish SSH connection: ". $ssh->error;
#$ssh->system("echo $dep_keys{$num} >> /root/1");
$ssh->system($cmd);
I expect that the file will contain new line in the end of file.
$numwill usually contain a trailing newline after reading from STDIN, so you should use chomp on it.$num.