in reply to Net::SSH2 related query

Cannot test that at the moment, but the write to the channel should need a trailing newline. so
... $chan->write("ls\n"); ...
Also see here: A little demo for Net::SSH2