$ssh->expect(10, [ qr 'wall#', sub { $ssh->send("ping 172.16.10.29\n"); # how do I get the output of this ping into a variable? }], );