The previous replies might be good guesses about the nature of your goal, or about what you're doing wrong, but your main problem is that you haven't told us enough about what you are actually doing (apart from what you are trying to do, which is also a bit vague).

What sort of interactive command are you trying to run? (Hint: if it has anything to do with logging into some remote host, that affects what the solution ought to be.)

Is it your intention that the person running the perl script is supposed to type things (after the perl script starts the "interactive command") and these things are then conveyed to (acted on by) the child command process? If so, what sort of value is the perl script supposed to be adding (that is, why use a perl script at all, rather than just running the "interactive command" directly)? If not, just what are you trying to accomplish?

You might need IPC::Open2 (or Open3), or you might need Expect. When you us only vague information, we can only give you back vague advice.


In reply to Re: Execute Interactive commands by graff
in thread Execute Interactive commands by sonalig

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.