Multidimensional Arrays(Lists of Lists) : Multidimensional Arrays « Array « Perl

Home
Perl
1.Array
2.CGI
3.Class
4.Data Type
5.Database
6.File
7.GUI
8.Hash
9.Language Basics
10.Network
11.Regular Expression
12.Report
13.Statement
14.String
15.Subroutine
16.System Functions
17.Win32
18.XML
Perl » Array » Multidimensional Arrays 




Multidimensional Arrays(Lists of Lists)
    

# A two-dimensional array consisting of rows and columns
@matrix=( [ 4],    # Each row is an unnamed list
          2,  7],
          0,  3],
          6,  5],
        ;
print "@matrix\n";
print "Row 0, column 0 is $matrix[0][0].\n"
print $matrix[0]->[0];
print "Row 1, column  0 is $matrix[1][0].\n";
print $matrix[1]->[0];
for($i=0; $i < 4; $i++){
    for($x=0; $x < 3; $x++){
        print "$matrix[$i][$x] ";
    }
    print "\n";
}

   
    
    
    
  














Related examples in the same category
1.Using multi-dimensional array references.
2.Using multi-dimensional array references again.
3.Lists of Lists
4.How to use two dimensional arrays
5.Output two -dimensional array
6.References to Simulate Multi-Dimensional Arrays
7.Using array reference to create two-dimensional array
8.Using @ operator and one dimensioanal array to create two dimensioanl array
9.Two dimensional array is array of array
10.A three-dimensional array
11.Using array reference to index the two dimensional array
12.Using two-dimensional array
13.Program to demonstrate a pointer to a two-dimensional array
14.'use strict' with two dimensional array
15.Array of array
16.Reference the outter array of an two dimensional array
17.Two dimensional array is array scalar plus array
18.Using the -> to reference the elements of a two-dimensional array
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.