You have two nested loops using $i as the looping variable. Just change the inner one to something else:
for my $j($a..$b){ print $write_tmp_app_log $lines[$j] };
UPDATE: added my to $j.
UPDATE: avoid the inner loop altogether:
print $write_tmp_app_log @lines[$a..$b];UPDATE: I guess if you just had added a my to the $i in the inner loop like for my $i($a..$b){ it would work as well but for my personal feeling that would be to dangerous.
In reply to Re: Print 5 lines before and after pattern match from a list
by hdb
in thread Print 5 lines before and after pattern match from a list
by jayu_rao
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |