by setting %a to $readn, the next time the loop reads from the file, it'll start at the last line that found a match.

eg: A file with 100 lines, and matches on lines 5, 10, & 20.

Without setting %a to $readn, it'll match 5 times before getting to the next line that doesn't match

Setting %a to $readn, means that it'll find the match on 5, then look from 5 on (technically...realistically it's 6)

Regarding the other items you mentioned...agreed across the board...just wrote it up quickly.