in reply to Returning Array

First error is here sub findLines;

Fix is write sub findLines { ... }

Explanation , use diagnostics

$ perl -e " return " Can't return outside a subroutine at -e line 1. $ perl -Mdiagnostics -e " return " Can't return outside a subroutine at -e line 1 (#1) (F) The return statement was executed in mainline code, that is, w +here there was no subroutine call to return out of. See perlsub. Uncaught exception from user code: Can't return outside a subroutine at -e line 1. at -e line 1.