How do I input file line results into an array?
===

My code so far only reads lines 1 to 4 and prints them. What I want to do instead of printing them is putting them into an array. So any help would be greatly appreciated. And hopefully just the code since it should be short. I learn much faster looking at full code instead of opening another 50 tabs trying to put multiple concepts together. Hopefully I'll learn this at some point and won't require help.

Thanks in advance.


    my $x = 1;
    my $y = 4;

    open FILE, "file.txt" or die "can not open file"; while (<FILE>) { print if $. == $x .. $. == $y; }
