in reply to reading file into an array
use File::Slurp; my @array = read_file('filename.txt'); [download]
That's all there is to it.