http://www.perlmonks.org?node_id=1010577


in reply to multidimensional array's

use strict; use warnings; use 5.012; my $row1_ref = ['a', 'b', 'c']; my $row2_ref = ['xx', 'yy', 'zz']; my $data; push @$data, $row1_ref; push @$data, $row2_ref; use Data::Dumper; say Dumper($data); --output:-- $VAR1 = [ [ 'a', 'b', 'c' ], [ 'xx', 'yy', 'zz' ] ];
my( $author, $title, $results ) ; while ( my($lineno, $row_ref) = each @$data) { $author = $row_ref->[0]; $title = $row_ref->[1]; $results->[$lineno]->[1] = $row_ref->[2]; } say Dumper($results); --output:-- $VAR1 = [ [ undef, 'c' ], [ undef, 'zz' ] ];