All,

I have a file that is filled with exercises that was written in a brand of
lamstex that I need to convert to latex. Exercises begin like this:

\ex If $f(x)=x^2$, blah ...

That is, I can count on each exercise beginning with the \ex macro.

Now there are at times instructions for groups of exercises. They look like
this:

\begin{instructions}
Blah, blah, blah, ...
\end{instructions}

As I begin reading in lines from the file, I just print them until I hit a
line that has an opening "\ex" in it. At that point I want to accumulate
lines in one long string until I hit either "\begin{instructions}" or
another "\ex".

$line.=<IN>   #unless the current line coming in from IN is the start
                  #of a new \ex or a \begin{instructions}

The difficulty is now I've read one line too many. I'd like to "put this
last line back" for the next round of reading while I process the
accumulated exercise lines.

Is there a standard way of handling this difficulty?





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to