At Wed, 10 Jun 1998 21:49:45, Carl Johan Berglund wrote: [stuff deleted] > >The null pattern (//) means the last successfully executed pattern. In the >above subroutine, the null pattern is never used if the /$endpat/ pattern >succeeds. > >If the first line doesn't match /$endpat/, the // pattern is used, but >since there is no successfully executed pattern, it won't match, and the >subroutine will return after printing the first line. > >To make the solution work, you must make a pattern that will succeed on the >first line - as I did previously. > [stuff deleted] Hmm... how would you you 'precompile' a pattern that is supposed to be the ending condition? That is, I want to read lines, and match them *until* it matches the pattern... Would you suppose this would be the way to do it?: sub readAndPrintTillMatch { my ($theFileHandle,$theMatch,$theResponse) = @_; my $output; do { $output = <$theFileHandle>; print "$output"; flush(STDOUT); } until ($output =~ $theMatch); # Note: no // around re ^^^^^^^^^ print $theFileHandle "$theResponse\n"; print "$theResponse\n"; flush(STDOUT); } &readAndPrintTillMatch(SOCKET,/Please enter your term type/o,"01"); # Note: //o around re ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Tom. "Now, we can do this the hard way, or...well, actually, there's just the hard way." -- "Welcome to Hellmouth" - Buffy, the Vampire Slayer ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch