in reply to Perl and Emacs

I'm not an emacs expert but the shells inside emacs seem to "steal" the new lines, so the redirection that you hope for (keyboard ---> program's STDIN) doesn't work. This one works for me though:
echo "MYNAME" | perl -e ' ...your program here...'
HTH