|
Posted by John W. Krahn on November 6, 2006, 4:45 am
Please log in for more thread options
pdc124 wrote:
> Im retrieving screens of information from a telnet server, going
> (backwards) from one to the next by pressing '0'. When I get to the
> first one a message 'No more previous attendances' flashes on the
> screen .
> thuis retrieves the screens
> ($names)=$t2->waitfor('/Main Index Details/');
> print $names;print $q-> hr;
> do
> {$t2->print('0');
>
> my ($names2)=$t2->waitfor('/Main Index Details/');
> $names=$names.$names2;
> print $names;print $q-> hr;
> }
>
> until ($names=~/No\s+more/);
>
> 'No more previous' appears in dump_file and input_string but not in
> $names;
>
> Version 2 generates an error
> Can't "last" outside a loop block at /var/www/localhost/cgi-bin/pas2.pl
> line 119.
>
> my $last=0;
> do
> {$t2->print('0');
> $text='';
> do {$text=$t2->get;
> #print $text;print $q-> hr;##debugging string
> if ($text=~m/previous/)
> $names.=$text;}
> until ($text=~m/Delete/);
> }
> until ($last);
> print $names;print $q-> hr;
>
> so how do i exit the loops when it finds the text ?
See the end of the "Statement Modifiers" section of perlsyn for a solution:
perldoc perlsyn
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
|