while(){ next unless /$date/ .. eof(LOG); print LOGFILE; } #### my @input = ; foreach (@input) { next unless /$date/ .. undef; print LOGFILE; } #### my @input = ; { my $found = 0; foreach (@input) { $found = 1 if /foo/; print LOGFILE if $found; } }