in reply to Segfaulting of a perl script

I think you have a syntax error way toward the end, with the ;, in
[ qr/password: /i, sub { my $self = shift; $self->send("$password\n");, exp_continue; }], [ qr/\[y\/n\]: /i, sub { my $self = shift; $self->send("y\n");, exp_continue; }], );
Removing the , lets it at least pass the syntax check (I don't have the modules installed to test whether it actually works.