in reply to reading file into an array

The easiest and fastest possible way to do this is via File::Slurp.

use File::Slurp; my @array = read_file('filename.txt');

That's all there is to it.