David Precious <dav...@preshweb.co.uk> writes:
> Instead of assigning the result of $port->lookfor to $c, you've created
> a new lexically-scoped $c (with "my $c") which exists only within that
> loop body execution - after the execution, it goes away, and the $c the
> loop is looking for, at a higher scope, will still be empty.
> 
> I imagine things might change if you remove the "my" from that
> assignment, so that you're assigning the result to the $c that the loop
> condition is looking at.

Of course!  I didn't even give that a second thought.

        I removed 'my' and wrote a test loop for another old P.C.
I have here which sends the string

0 1 2 3 4 5 6 7 8 9

followed by a carriage return every 2 seconds.  I am using a
kermit script for that and a null-modem cable to send to ttyS0 on
the system running the now-working perl app.

        I put the digit '8' in the are_match expression and now,
when I run the perl application, I see

0 1 2 3 4 5 6 7 so it is breaking the string on 8 which is
precisely what I need for the test to work.

        Now I can go on and do something useful.  I was being
dense, here, I think.

Thank you very much.

Martin McCormick

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to