$p->are_match( "\r", "\n" ); while () { if( my $line = $p->lookfor ) { Process_Line( $line ); } if( $p->write_done(0) ) { my $command = Fetch_Command(); $p->write( $command ) if $command; } sleep 1; }