Monks,
I open a file for reading . my program pattern matches for a word. It then prints that line and should also print the line above it. how do I do that??
my code looks like ......
use strict;
use warnings;
my $file;
chomp ($file = <STDIN>);
open (MYFILE,"<$file") or die $!;
while (><MYFILE>) {
if(/ALARM:/) {
print "$.: $_";
}
}
close MYFILE;