Jim Gibson <jimsgib...@gmail.com> writes: > We need to know what you are trying to accomplish here.
Its over 300 lines of code at this writing. Where the re come in: The program searches only headers for a given RE, but it also returns the date line in any messages where the RE hits pay dirt. The search RE is set from the command line.. if it should happen to be an RE looking for a specific date then two date lines would be output for each message with a hit, since the DATE line is returned by default anyway. So I tried to setup a test to avoid collecting the default DATE line if the command line regex matched the default Date regex. So: if (cmdline_re NOT match Default DATE_re){ then go ahead and collect the date line for later print } (In the real case there was no `else',) After hearing why the error comes up... The match doesn't really involve $_.. so not quite sure how to phrase it. I guess it could be done at the print call where after the line hit by cmdline regex has been collected, the dateline (if present) and the absolute filename are output. (I haven't tested this.. but something along this line) while (<FILE>) { [...]bla bla [...]match this [...]match that bla if (/^$/) {#if we see a blank line if ($PRINT) { # PRINT was set to true when match to cmdline_re was seen if (line_hit_by_re !~ /^Date:/) { #if line collected NOT match ^Date: ## There is some slim chance a message will not have a dateline ## so we print it if we have it. if ($dateline) { ## if we've collected default date print "$dateline\n"; } print "$line_hit_by_re\nAbsoluteFileName ===== ===== ===== ===== ===== =====\n"; } else { # Don't print the dateline, just the rest print "$line_hit_by_re\nAbsoluteFileName ===== ===== ===== ===== ===== =====\n"; } ## we are done - so out of `while' and back to `find()' last; } } } -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/