use Expect; $Expect::Exp_Internal = 1; # for debugging my $cmd = Expect->spawn('/usr/bin/sshfs', 'root@moto:/mnt/sdcard/eBooks', 'mnt') or die $!; $cmd->expect(undef, 'root@moto\'s password: '); $cmd->send("XXXX\n");