# if you prefer the OO mindset: my $exp = new Expect; $exp->raw_pty(1); $exp->spawn("./unrar", "e", $file); or die "Cannot spawn $command: $!\n"; # send some string there: $exp->send("PASSWORD\n");