Multidimensional Array Perl Example

Example for Multidimensional Array in Perl Program


This Perl program is one of the best example to learn Multidimensional Array. Here I'm just assigning some values and printing the values using array.
//source code multidimensional-array-example.pl

#!/usr/bin/perl
use strict;
use warnings;

my @matrix;


$matrix[0][0] = 0;
$matrix[1][1] = 11;
$matrix[1][2] = 12;


#print "$matrix
";
print "$matrix[0]
"; # ARRAY(0x814dd90)
print "$matrix[1][1]
"; # 11


use Data::Dumper qw(Dumper);
print Dumper @matrix;


Related Topic What are all Perl Internal Data Types
How to Create Scalar Values Manipulation in Perl Scripting
What is Scalar Values Manipulation in Perl Scripting
Array Search in Perl
count() - How to Count All Elements in PHP Array or Properties in an Object?
Perl  

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback