in reply to Re: How can I print three lines before pattern match?
in thread How can I print three lines before pattern match?
Or if you don't want to test the length of your array forevermore:
my @history = ("\n") x 3; while (<>) { print @history if /pattern/; push @history, $_; shift @history; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How can I print three lines before pattern match?
by neurotoxx (Novice) on Aug 14, 2009 at 14:00 UTC | |
|
Re^3: How can I print three lines before pattern match?
by ikegami (Patriarch) on Aug 14, 2009 at 14:56 UTC | |
by neurotoxx (Novice) on Aug 14, 2009 at 22:37 UTC | |
by ikegami (Patriarch) on Aug 15, 2009 at 02:12 UTC | |
by neurotoxx (Novice) on Aug 17, 2009 at 01:42 UTC | |
by ikegami (Patriarch) on Aug 17, 2009 at 02:23 UTC | |
by neurotoxx (Novice) on Aug 17, 2009 at 16:43 UTC | |
by ikegami (Patriarch) on Aug 17, 2009 at 17:12 UTC |