Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; my $file; chomp ($file = <STDIN>); open (MYFILE,"<$file") or die $!; while (><MYFILE>) { if(/ALARM:/) { print "$.: $_"; } } close MYFILE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: when reading a file how to print a line one above the current line??
by jeffa (Bishop) on Jun 04, 2002 at 04:35 UTC | |
by graff (Chancellor) on Jun 04, 2002 at 08:04 UTC | |
by Aristotle (Chancellor) on Jun 04, 2002 at 11:50 UTC | |
by Aristotle (Chancellor) on Jun 04, 2002 at 11:55 UTC | |
by dsheroh (Monsignor) on Jun 04, 2002 at 17:10 UTC | |
by Aristotle (Chancellor) on Jun 05, 2002 at 06:06 UTC | |
|
Re: when reading a file how to print a line one above the current line??
by Abigail-II (Bishop) on Jun 04, 2002 at 11:35 UTC |