Perl doesn't do exactly what you want in this case. You need to explicitly tell Perl how to print out your array.
Try this:
use Data::Dumper;
print Dumper( $array[0] );
Or this:
foreach my $element ( @{ $array[0] } ) {
print $element, "\n";
}
Or this:
print join ' ', @{ $array[0] };
print "\n";
Here's your example code, re-written a bit to do more error checking, and turn on strict and warnings. When these are turned on, Perl will do more checking and restrict you to a safer subset of the language.
#!/usr/bin/perl
use strict;
use warnings;
my @arrays;
my $fn = 'summary.txt';
open FILE, "<$fn" or die "Error opening file ($!)";
while( my $line = <FILE> ) {
chomp $line;
my @data = split ' ', $line;
push @arrays, \@data;
}
close FILE or die $!;
# print out comma-separated arrays, one per line
foreach my $array (@arrays) {
print join ",", @$array;
print "\n";
}