Yurttas/PL/SL/perl/F/07/01/01/aa 02.pl

 1# 
 2#  Copyright(C) 1998
 3#  All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4#
 5#  Permission from use, copy, modify, and distribute this
 6#  software and its documentation for EDUCATIONAL purposes
 7#  and without fee is hereby granted provided that this
 8#  copyright notice appears in all copies.
 9#
10#  date   : January 1, 1998.
11#  authorĀ : Salih Yurttas.
12#
13#  aa_02.pl
14#
15
16
17use warnings;
18
19# create array of array
20@aa = ( [0, 1, 2, 4, 8],
21        [1, 3, 5],
22        [0, 2, 4, 8], ); 
23
24for $row (@aa) {
25  print "@$row \n";
26}
27
28push @{$aa[0]}, 3, 5;
29print "\n";
30
31for $i (0..$#aa) {
32  print "@{$aa[$i]} \n";
33}
34
35push @{$aa[3]}, 6, 4, 2;
36print "\n";
37
38print "\n";
39
40for $i (0..$#aa) {
41  for $j (0..$#{$aa[$i]}) {
42    print "$aa[$i][$j] ";
43  }
44  print "\n";
45}
46
47print "\n";
48
49for $i (0..$#aa) {
50  $t = $aa[$i];
51  for $j (0..$#{$t}) {
52    print "$t->[$j] ";
53  }
54  print "\n";
55}