use Data::Dumper; open(DAT, "< file") or die $!; while() { chomp; push @data, [ split( /,/ ) ]; # or split( /,/, $_ ) } print Dumper \@data;