use strict; use warnings; my $THRESHOLD = 2.5; LOG_ENTRY: while (my $line = <DATA>) { if ($line =~ /^(\d+)/) { my $stamp = $1; if ($stamp > $THRESHOLD) { process_line( $line ); last LOG_ENTRY; } } else { warn "Bad line: $line"; } } while (my $line = <DATA>) { process_line( $line ); } exit(0); sub process_line { print $_[0]; } __DATA__ 1 llama 2 alpaca 3 camel 4 badger
prints:
3 camel 4 badger
HTH.
In reply to Re: print log file
by fenLisesi
in thread print log file
by xiaoyafeng
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |