in reply to How to get data to an array?

Unfortunately, what you've shown so far is not coherent information. E.g.,
my @data = [1,5,7,8,9,10,11,3,3,5,5,5,7,2,2];
isn't particularly useful since you're assigning a scalar list reference to an array (meaning that you'll always end up with a single-element array.) Something like this would make more sense:
my $data = [1,5,7,8,9,10,11,3,3,5,5,5,7,2,2];
I'm going to make some assumptions here about what you're trying to do; please feel free to correct any false ones. If you're trying to read a file that is composed of lines with comma-separated values, and where each line should be read in as a list reference of the above type, then something like this should be useful:
use strict; open my $fh, '<', 'file' or die "file: $!\n"; my @data; while (<$fh>){ chomp; push @data, [split /,/]; }
Each of the elements of @data will be a reference to a list containing the values on each line.

Replies are listed 'Best First'.
Re^2: How to get data to an array?
by thanos1983 (Parson) on Sep 01, 2017 at 00:15 UTC

    Hello flightdm,

    You do not need to open the file handle and pass it to the diamond operator for reading. You can do it all in one, ref. I/O Operators. Read also eof for multiple files.

    Sample of code with output:

    Hope this helps, BR.

    Seeking for Perl wisdom...on the process of learning...not there...yet!
      Hi -

      Thanks, but I'm quite familiar with the DATA filehandle, STDIN, and other methods of getting the data in. I'm not sure why you're bringing it up, since the scenario I stated -

      If you're trying to read a file that is composed of lines with comma-separated values

      - explicitly specifies an external file, as does the OP's request... and your addendum has no relation to the solution that was asked for (that is, getting data into an array.)

      Perhaps it'll add to someone's education, though.