How do you run those programs inside emacs? I guess this is on Windows? Are you using Powershell as your shell-file-name?
One annoying effect I see on Windows is that STDOUT is buffered. So, if you're expecting a prompt, then you won't see it in time, but you can still enter your input line when the program seems to "hang". The w32 FAQ has a workaround for "Perl script buffering".
I could run the following program under M-x perldb and M-x eshell, and it behaves as I would expect:
use 5.028;
# Turn all buffering off.
select((select(STDOUT), $| = 1)[0]);
select((select(STDERR), $| = 1)[0]);
select((select(STDIN), $| = 1)[0]);
print "Give me a cookie: ";
my $thing = readline(STDIN);
$thing =~ /^(a )?cookie$/ or die "That was no cookie.\n";
say "Thanks and goodbye!";