use Net::Telnet ();
$remote = new Net::Telnet (Timeout => 10,
Errmode => 'return');
$remote->open("sparky") or die $remote->errmsg;
$remote->waitfor('/login: $/i') or die $remote->errmsg;
$remote->print("joebob") or die $remote->errmsg;
$remote->waitfor('/password: $/i') or die $remote->errmsg;
$remote->print("passwd-for-joebob") or die $remote->errmsg;
$remote->waitfor('/\$ $/') or die $remote->errmsg;
$remote->print("df -k") or die $remote->errmsg;
($output) = $remote->waitfor('/\$ $/')