#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper;

my $pos = tell DATA;

my @tmp;
my @AoA;
while (<DATA>) {
    @tmp = split;
    push @AoA, \@tmp;
}

print "wrong:\n", Dumper \@AoA;

seek DATA, $pos, 0; 
@AoA = ();

while (<DATA>) {
    @tmp = split;
    push @AoA, [@tmp];
}

print "right:\n", Dumper \@AoA;
__DATA__
1 2 3
4 5 6
7 8 9