open my $fh => $file or die "Failed to open $file: $!\n"; my $last = ""; while (<$fh>) { print "$last$_" if /ALARM:/; $last = $_; } close $fh;
Abigail
In reply to Re: when reading a file how to print a line one above the current line??
by Abigail-II
in thread when reading a file how to print a line one above the current line??
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |