Yeah I'm sorry about that. Had to take it down. Don't want to get plagiarised.

Anyway to the other replies, the reason I want to unshift to STDIN is because when my forth interpreter reads the "call" function, I want to unshift the commands stored in the variable onto STDIN. I'll elaborate. When curly braces are encountered, everything in it until the closing brace is added to a string. This string is then stored into a variable declared earlier. Like:

pop3 { pop pop pop } store
the string "pop pop pop" is stored into pop3 (via hash tables)

then, when i do pop3 call, I want to unshift "pop pop pop" onto STDIN to be read.

I've already implemented this differently by reading it everything from STDIN until EOF into a list, then handling each element of the list as though it is read from STDIN. Thus, I can unshift "pop pop pop" onto the list.

Is there any other way to do this more elegantly?

In reply to Re: Re: Manipulating STDIN by ChwanRen
in thread Manipulating STDIN by ChwanRen

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.