#... code defines @my_matrix at this point foreach my $row ( @my_matrix ) { print join(', ', @{$row}), "\n"; }