I'm not sure what you mean by hanging. Do you mean it's not terminating? If so, do you know where it's stuck? Most likely, since the remote host hasn't closed the connection and therefor telnet is still running and hasn't closed the IN handle, while(<IN>) is blocked waiting for data. I also don't see any attempt at actually sending a command to the remote host. Is the user supposed to type that in? You'd have to do that yourself in that case. Are you printing a command but nothing happens? In that case you probably haven't read Suffering from Buffering.

Also, it seems you haven't quote understood what the file handles do - or is Trying a command on the remote machine? That is the only reason you should be printing it to OUT, but it doesn't seem likely to me.

Makeshifts last the longest.


In reply to Re^3: Modifying STDOUT and keeping control by Aristotle
in thread Modifying STDOUT and keeping control 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.