I am new to perl, and so to practice writing to another program, I decided to automate something I do often: FTPing into my email server to retrieve the contents of my inbox. (Since I can't use telnet at work, stupid firewalls.) Here is what I have:
#!/usr/bin/perl open (FTP, "|ftp") || (die "Couldn't fork process"); print FTP "open my.email.server\n"; print FTP "my_userid\n"; print FTP "my_password\n"; print FTP "lcd /windows/desktop\n"; print FTP "get /var/mail/userid\n"; #location of my inbox print FTP "bye\n"; close FTP;
The odd thing is this: it works fin until the point at which it *should* put in the password for me. Then it hangs. If at this point I type the password and press enter, it says "Invalid command", and then continues as normal, putting the inbox file on the desktop as it should. What is going on here? Is there any way around this? Thanks.

In reply to Writing to a program by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.