in reply to howto parse (or determining end) of a line of perl

Good luck...

You could try eval on what you have and if it gives an error change prompt and read more :)

That may work some of the time, especially if you leave an operator at the end of the line.

(I have a much better way, but the margins of this note don't have enough room to explain it.)

  • Comment on Re: howto parse (or determining end) of a line of perl

Replies are listed 'Best First'.
Re^2: howto parse (or determining end) of a line of perl
by perl-diddler (Chaplain) on Aug 25, 2016 at 00:47 UTC
    Yeah thought about that (eval+error->reprompt). Problem w/that is that evaluating it could change the 'environment' such that re-evaluating it later wouldn't work.

    (Example in my margins; ;-))

      Maybe starting a thread to test compile the expression. "Return" success or fail to the main then end the thread.

      (Maybe I'm misremembering, but I think that threads in Perl work by creating additional PVMs to execute the threads.)

      Or try using Safe (which is a core module) to test-compile the expressions.