# Open pipe OPENPIPE: unless (open $fifo, '<', $pipe) { log_it("Cannot open $pipe: $!"); sleep 5; next OPENPIPE; } READPIPE: while (my $line = <$fifo>) { next READPIPE unless defined $line; chomp $line; # Process line next READPIPE unless $clean = strip_junk($line); next READPIPE unless $log = find_log_name($clean); ($text) = ($clean) =~ /^\w+\s+(.*)/; write_line($text); }