In order to access a single element of an array you would usually write $arr[$count] and not @arr[$count]. If you add use strict;use warnings; at the beginning of your script, Perl would highlight those occations to you. In order to access the element before $arr[$count], you would write $arr[$count-1], potentially checking that $count is greater than zero beforehand.
In reply to Re: Perl: How to match a line and print words at line immediately above it?
by hdb
in thread Perl: How to match a line and print words at line immediately above it?
by WWq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |