$exp->expect($timeout, [ qr/login:/i, sub{ my $exp = shift; $exp->send("$user\n"); exp_continue; }], [ qr/password:/i, sub{ my $exp = shift; $exp->send("$pass\n"); exp_continue; }], '-re', qr/[#>:\$] $/, );