in reply to storing return value from Expect

I wasn't able to get it to work using the calling-syntax you were using, which is a pity, as I think is the neatest way to call expect. Anyway, here is what I came up with as a possibility:
$ssh->expect(10, '-re', 'wall#'); $ssh->send("ping 172.16.10.29\n"); $ssh->expect(10,"\n"); $ssh->expect(1); $bla = $ssh->before();
Note that the second expect line is only required if echo is on. Even if it is, you can miss out the line if you don't mind grabbing the ping command as part of $bla.
The timeout value in the last expect line should be set based on how long the ping will take.

Hope this is helpful,
Yoda