my $logger = Log::Log4perl->get_logger(); open INPUT, '-|', '/some/program/with/verbose/output'; while( my $line ) { foreach my $watch_string ( $schema->resultset('WatchString')->all ) { if( $line =~ $watch_string->match_re() ) { # Do stuff my $log_message = join(' ', 'Interesting output '. $watch_string->comment, $line); $logger->log( $watch_string->log_level, $log_message); } } }