#! perl use strict; use warnings; use Data::Dump; my @matrix; my $row = 0; push @{$matrix[$row++]}, split while ; dd @matrix; print 'element at col 3, row 2 is ', get_element(\@matrix, 3, 2), "\n"; sub get_element { my ($matrix_ref, $col, $row) = @_; return $matrix_ref->[$row - 1][$col - 1]; } __DATA__ 20 30 40 60 70 80 90 100 49 #### 23:50 >perl 548_SoPW.pl ([20, 30, 40], [60, 70, 80], [90, 100, 49]) element at col 3, row 2 is 80 23:50 > #### my @matrix; push @matrix, [ split ] while ;