in reply to reading file into an array

first, you're reading in the filehandle in scalar context, which only reads one line in.
to get the whole file into $lines, you have to set $/ to undef (see perlvar), like:

my $lines = do { local $/; # sets $/ locally to undef; <FILE>; };
second, then you split the whole file into an array; this could be done easier by reading in in list context: my @array = <FILE>;