You could use a loop instead of using grep, and keep a counter to remember the line number, or just remember not only the current line but also the line before it.
my @list = <DATA>; chomp @list; my $prev_line; for my $line (@list) { # Look at current line # remember this line as "previous" };
In reply to Re^3: Help editing a file based off seach criteria
by Corion
in thread Help editing a file based off seach criteria
by perlnewb123
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |